Compare commits
2 commits
15b1aaf83b
...
8cd6f8eb17
Author | SHA1 | Date | |
---|---|---|---|
|
8cd6f8eb17 | ||
|
1f3a62a7a8 |
2 changed files with 3 additions and 4 deletions
|
@ -31,6 +31,8 @@ public class HttpResponse
|
|||
|
||||
public static HttpResponse BadRequest(HttpContent? content = null) => new HttpResponse(400, "Bad request", content);
|
||||
|
||||
public static HttpResponse Forbidden(HttpContent? content = null) => new HttpResponse(403, "Forbidden", content);
|
||||
|
||||
public static HttpResponse NotFound(HttpContent? content = null) => new HttpResponse(404, "Not found", content);
|
||||
|
||||
public static HttpResponse NotAcceptable(HttpContent? content = null) => new HttpResponse(406, "Not acceptable", content);
|
||||
|
|
|
@ -90,10 +90,7 @@ class MIMETypeConverter : JsonConverter<MIMEType>
|
|||
|
||||
public override MIMEType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
string? str = reader.GetString();
|
||||
if (str == null)
|
||||
throw new JsonException("Cannot read MIME type");
|
||||
|
||||
string? str = reader.GetString() ?? throw new JsonException("Cannot read MIME type");
|
||||
return new MIMEType(str);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue