Skip to content

Commit 655c2da

Browse files
committed
Remove HttpResponseMessage allocation in hot path
1 parent 017b584 commit 655c2da

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private static bool CanWriteBody(HttpStatusCode statusCode)
118118

119119
private static bool IsSuccessStatusCode(HttpStatusCode statusCode)
120120
{
121-
return new HttpResponseMessage(statusCode).IsSuccessStatusCode;
121+
return (int)statusCode is >= 200 and <= 299;
122122
}
123123

124124
private string RenderModel(object? model)

0 commit comments

Comments
 (0)