Renaming CloudEventInputFormatter to CloudEventJsonInputFormatter

Signed-off-by: Tobias Lønnerød Madsen <m@dsen.tv>
This commit is contained in:
Tobias Lønnerød Madsen 2019-11-07 08:50:12 +01:00
parent 135f1f2e7c
commit 340ba9cca9
No known key found for this signature in database
GPG Key ID: E51953EA8372F2AC
4 changed files with 5 additions and 6 deletions

View File

@ -224,14 +224,14 @@ var cloudEvent = await HttpContext.Request.ReadCloudEventAsync();
### HTTP - ASP.NET Core MVC ### HTTP - ASP.NET Core MVC
If you would like to deserialize CloudEvents in actions directly, you can register the If you would like to deserialize CloudEvents in actions directly, you can register the
`CloudEventInputFormatter` in the MVC options: `CloudEventJsonInputFormatter` in the MVC options:
```C# ```C#
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddMvc(opts => services.AddMvc(opts =>
{ {
opts.InputFormatters.Insert(0, new CloudEventInputFormatter()); opts.InputFormatters.Insert(0, new CloudEventJsonInputFormatter());
}); });
} }
``` ```

View File

@ -25,7 +25,7 @@ namespace CloudNative.CloudEvents.AspNetCoreSample
{ {
services.AddControllers(opts => services.AddControllers(opts =>
{ {
opts.InputFormatters.Insert(0, new CloudEventInputFormatter()); opts.InputFormatters.Insert(0, new CloudEventJsonInputFormatter());
}); });
} }

View File

@ -10,9 +10,9 @@ namespace CloudNative.CloudEvents
using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
public class CloudEventInputFormatter : TextInputFormatter public class CloudEventJsonInputFormatter : TextInputFormatter
{ {
public CloudEventInputFormatter() public CloudEventJsonInputFormatter()
{ {
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json")); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/cloudevents")); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/cloudevents"));

View File

@ -6,7 +6,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit" Version="2.4.0" /> <PackageReference Include="xunit" Version="2.4.0" />