Skip to content

Commit

Permalink
Use new JSON serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Feb 19, 2019
1 parent 68a54c9 commit be5d5cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Samples/MyHandler.RouteProvider.cs
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -116,7 +117,7 @@ private async Task Post(HttpContext httpContext)
{
var handler = new MyHandler();

var bodyValue = (JValue)await _reader.ReadAsync(httpContext, typeof(JValue));
var bodyValue = (JsonDocument)await _reader.ReadAsync(httpContext, typeof(JsonDocument));

var result = handler.Post(bodyValue);
await result.ExecuteAsync(httpContext);
Expand Down
3 changes: 2 additions & 1 deletion Samples/MyHandler.cs
@@ -1,4 +1,5 @@
using System;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
Expand Down Expand Up @@ -65,7 +66,7 @@ public async Task<string> GetAsync([FromRoute]string name)
public string Hello() => "Hello!";

[HttpPost("/")]
public Result Post([FromBody]JToken obj)
public Result Post([FromBody]JsonDocument obj)
{
return Ok(obj);
}
Expand Down
1 change: 0 additions & 1 deletion Samples/Program.cs
Expand Up @@ -14,7 +14,6 @@ public static void Main(string[] args)

public static IHost BuildWebHost(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging => logging.ClearProviders())
.ConfigureWebHostDefaults(webHostBuilder =>
{
webHostBuilder.UseStartup<Startup>();
Expand Down

0 comments on commit be5d5cf

Please sign in to comment.