Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
OpportunityLiu committed Apr 29, 2019
1 parent 1b15c44 commit 6f1d2ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions EhTagApi/Formatters/TextFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public TextFormatter()
public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
{
var request = context.HttpContext.Request;
var content = Microsoft.Net.Http.Headers.MediaTypeHeaderValue.Parse(request.ContentType);
using (var reader = context.ReaderFactory(request.Body, content.Encoding ?? Encoding.UTF8))
Microsoft.Net.Http.Headers.MediaTypeHeaderValue.TryParse(request.ContentType, out var content);
using (var reader = context.ReaderFactory(request.Body, content?.Encoding ?? Encoding.UTF8))
{
return await InputFormatterResult.SuccessAsync(await reader.ReadToEndAsync());
}
Expand Down
4 changes: 2 additions & 2 deletions examples.http
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Content-Type: application/json
}

### 序列化条目
POST {{base}}/api/tools/serialize/gotoubun%20no%20hanayome
POST {{base}}/api/tools/serialize/gotoubun no hanayome
Content-Type: application/json

{
Expand All @@ -83,6 +83,6 @@ Content-Type: application/json
### 解析 MarkDown 条目
POST {{base}}/api/tools/parse
Accept: application/raw+json
Content-Type: text/plain
Content-Type: text/markdown

| gotoubun no hanayome | 五等分的新娘 | 《五等分的新娘》(日语:五等分の花嫁)是由日本漫画家春场葱所创作的少年漫画作品。于《周刊少年Magazine》2017年第36・37合并号开始正式连载中。 | [维基百科](https://zh.wikipedia.org/zh-cn/五等分的新娘) (*) |

0 comments on commit 6f1d2ae

Please sign in to comment.