Update the method used to read JSON asynchronously

This commit is contained in:
Wei Wang 2014-09-10 09:13:22 -07:00
parent 43fdf2a460
commit 13adde63fa
3 changed files with 3 additions and 3 deletions

View File

@ -424,7 +424,7 @@ namespace Microsoft.AspNet.Security.Google
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
{
var res = new HttpResponseMessage(HttpStatusCode.OK);
var text = await JsonConvert.SerializeObjectAsync(content);
var text = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(content));
res.Content = new StringContent(text, Encoding.UTF8, "application/json");
return res;
}

View File

@ -204,7 +204,7 @@ namespace Microsoft.AspNet.Security.Tests.MicrosoftAccount
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
{
var res = new HttpResponseMessage(HttpStatusCode.OK);
var text = await JsonConvert.SerializeObjectAsync(content);
var text = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(content));
res.Content = new StringContent(text, Encoding.UTF8, "application/json");
return res;
}

View File

@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Security.Twitter
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
{
var res = new HttpResponseMessage(HttpStatusCode.OK);
var text = await JsonConvert.SerializeObjectAsync(content);
var text = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(content));
res.Content = new StringContent(text, Encoding.UTF8, "application/json");
return res;
}