Update the method used to read JSON asynchronously
This commit is contained in:
parent
43fdf2a460
commit
13adde63fa
|
|
@ -424,7 +424,7 @@ namespace Microsoft.AspNet.Security.Google
|
||||||
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
|
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
|
||||||
{
|
{
|
||||||
var res = new HttpResponseMessage(HttpStatusCode.OK);
|
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");
|
res.Content = new StringContent(text, Encoding.UTF8, "application/json");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ namespace Microsoft.AspNet.Security.Tests.MicrosoftAccount
|
||||||
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
|
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
|
||||||
{
|
{
|
||||||
var res = new HttpResponseMessage(HttpStatusCode.OK);
|
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");
|
res.Content = new StringContent(text, Encoding.UTF8, "application/json");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Security.Twitter
|
||||||
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
|
private static async Task<HttpResponseMessage> ReturnJsonResponse(object content)
|
||||||
{
|
{
|
||||||
var res = new HttpResponseMessage(HttpStatusCode.OK);
|
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");
|
res.Content = new StringContent(text, Encoding.UTF8, "application/json");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue