aspnetcore.3.0.Formatters.InputFormatterStream.mustache Maven / Gradle / Ivy
{{>partial_header}}
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Formatters;
namespace {{packageName}}.Formatters
{
///
public class InputFormatterStream : InputFormatter
{
///
public InputFormatterStream()
{
SupportedMediaTypes.Add("application/octet-stream");
SupportedMediaTypes.Add("image/jpeg");
}
///
public override Task ReadRequestBodyAsync(InputFormatterContext context)
{
return InputFormatterResult.SuccessAsync(context.HttpContext.Request.Body);
}
///
protected override bool CanReadType(Type type)
{
if (type == typeof(Stream))
{
return true;
}
return false;
}
}
}