diff --git a/Storage/Storage.Test/ObjectTest.cs b/Storage/Storage.Test/ObjectTest.cs index 8951501..4fdf29d 100644 --- a/Storage/Storage.Test/ObjectTest.cs +++ b/Storage/Storage.Test/ObjectTest.cs @@ -30,24 +30,6 @@ namespace LeanCloudTests { Assert.False(obj.IsDirty); } - [Test] - public async Task TestHttp() { - if (SynchronizationContext.Current == null) { - TestContext.Out.WriteLine("is null"); - } - TestContext.Out.WriteLine($"current {SynchronizationContext.Current}"); - var client = new HttpClient(); - TestContext.Out.WriteLine($"request at {Thread.CurrentThread.ManagedThreadId}"); - string url = $"{AVClient.CurrentConfiguration.RTMServer}/v1/route?appId={AVClient.CurrentConfiguration.ApplicationId}&secure=1"; - var res = await client.GetAsync(url); - TestContext.Out.WriteLine($"get at {Thread.CurrentThread.ManagedThreadId}"); - var data = await res.Content.ReadAsStringAsync(); - res.Dispose(); - TestContext.Out.WriteLine($"response at {Thread.CurrentThread.ManagedThreadId}"); - TestContext.Out.WriteLine(data); - Assert.Pass(); - } - [Test] public async Task TestMassiveRequest() { await Task.Run(() => { diff --git a/Storage/Storage.Test/UserTest.cs b/Storage/Storage.Test/UserTest.cs index 4c6a1a6..4b5b012 100644 --- a/Storage/Storage.Test/UserTest.cs +++ b/Storage/Storage.Test/UserTest.cs @@ -42,7 +42,7 @@ namespace LeanCloudTests { [Test] public async Task Become() { - AVUser user = await AVUser.BecomeAsync("36idbfnt8hlmdo4rki0f5hevq"); + AVUser user = await AVUser.BecomeAsync("o8onm9bq8z127lz837mi6qhcg"); Assert.AreEqual(user, AVUser.CurrentUser); TestContext.Out.WriteLine($"{AVUser.CurrentUser.SessionToken} login"); } diff --git a/Storage/Storage.Test/Utils.cs b/Storage/Storage.Test/Utils.cs index 2a111d9..2faa60b 100644 --- a/Storage/Storage.Test/Utils.cs +++ b/Storage/Storage.Test/Utils.cs @@ -34,7 +34,7 @@ namespace LeanCloudTests { ApplicationKey = appKey, MasterKey = masterKey, ApiServer = apiServer, - EngineServer = engineServer, + EngineServer = engineServer }); AVClient.UseMasterKey = !string.IsNullOrEmpty(masterKey); AVClient.HttpLog(TestContext.Out.WriteLine); diff --git a/Storage/Storage/Internal/Command/AVCommandRunner.cs b/Storage/Storage/Internal/Command/AVCommandRunner.cs index 660d51b..c40bec5 100644 --- a/Storage/Storage/Internal/Command/AVCommandRunner.cs +++ b/Storage/Storage/Internal/Command/AVCommandRunner.cs @@ -66,7 +66,9 @@ namespace LeanCloud.Storage.Internal { } } // Session Token - if (AVUser.CurrentUser != null && !string.IsNullOrEmpty(AVUser.CurrentUser.SessionToken)) { + if (!request.Headers.Contains("X-LC-Session") && + AVUser.CurrentUser != null && + !string.IsNullOrEmpty(AVUser.CurrentUser.SessionToken)) { request.Headers.Add("X-LC-Session", AVUser.CurrentUser.SessionToken); } PrintRequest(httpClient, request, content);