* ObjectTest.cs: chore: 修复 session 重复的问题
* Utils.cs: * UserTest.cs: * AVCommandRunner.cs:
parent
aabd25d2e8
commit
f57fc6d884
|
@ -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(() => {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue