Renaming CloudEventInputFormatter to CloudEventJsonInputFormatter
Signed-off-by: Tobias Lønnerød Madsen <m@dsen.tv>
This commit is contained in:
parent
135f1f2e7c
commit
340ba9cca9
|
@ -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());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -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());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"));
|
|
@ -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" />
|
||||||
|
|
Loading…
Reference in New Issue