http: nitpick

This commit is contained in:
uwaa 2024-12-09 22:30:43 +00:00
parent 1f3a62a7a8
commit 8cd6f8eb17

View file

@ -90,10 +90,7 @@ class MIMETypeConverter : JsonConverter<MIMEType>
public override MIMEType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) public override MIMEType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{ {
string? str = reader.GetString(); string? str = reader.GetString() ?? throw new JsonException("Cannot read MIME type");
if (str == null)
throw new JsonException("Cannot read MIME type");
return new MIMEType(str); return new MIMEType(str);
} }