diff options
author | crupest <crupest@outlook.com> | 2021-02-10 14:31:31 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-10 14:31:31 +0800 |
commit | 98df0fb9fe94b703325f09bf765904a11e8a7d4c (patch) | |
tree | 544f7af5bdac4726404cc466e61947471949ffaa /BackEnd/Timeline/Formatters | |
parent | 4ea535d93753826ec900879560d876cec4d58c38 (diff) | |
download | timeline-98df0fb9fe94b703325f09bf765904a11e8a7d4c.tar.gz timeline-98df0fb9fe94b703325f09bf765904a11e8a7d4c.tar.bz2 timeline-98df0fb9fe94b703325f09bf765904a11e8a7d4c.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Formatters')
-rw-r--r-- | BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs (renamed from BackEnd/Timeline/Formatters/BytesInputFormatter.cs) | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/BackEnd/Timeline/Formatters/BytesInputFormatter.cs b/BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs index ac6537c9..2451ead6 100644 --- a/BackEnd/Timeline/Formatters/BytesInputFormatter.cs +++ b/BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using Microsoft.Net.Http.Headers;
using System;
using System.Threading.Tasks;
using Timeline.Models;
@@ -9,19 +8,21 @@ using Timeline.Models; namespace Timeline.Formatters
{
/// <summary>
- /// Formatter that reads body as bytes.
+ /// Formatter that reads body as byte data.
/// </summary>
- public class BytesInputFormatter : InputFormatter
+ public class ByteDataInputFormatter : InputFormatter
{
/// <summary>
///
/// </summary>
- public BytesInputFormatter()
+ public ByteDataInputFormatter()
{
- SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/png"));
- SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/jpeg"));
- SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/gif"));
- SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/webp"));
+ SupportedMediaTypes.Add(MimeTypes.ImagePng);
+ SupportedMediaTypes.Add(MimeTypes.ImageJpeg);
+ SupportedMediaTypes.Add(MimeTypes.ImageGif);
+ SupportedMediaTypes.Add(MimeTypes.ImageWebp);
+ SupportedMediaTypes.Add(MimeTypes.TextPlain);
+ SupportedMediaTypes.Add(MimeTypes.TextMarkdown);
}
/// <inheritdoc/>
@@ -41,7 +42,7 @@ namespace Timeline.Formatters var request = context.HttpContext.Request;
var contentLength = request.ContentLength;
- var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<BytesInputFormatter>>();
+ var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<ByteDataInputFormatter>>();
if (contentLength == null)
{
|