Skip to content

Commit 782542e

Browse files
authored
Update TypeMatchFilter.cs
should only be typechecking on json api requests that are patch or post... because of left to right evaluation and lack of parens this was evaluating as false || is post if the request was not a jsonapi request.
1 parent 3ade2a7 commit 782542e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/JsonApiDotNetCore/Middleware/TypeMatchFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public TypeMatchFilter(IJsonApiContext jsonApiContext)
2222
public void OnActionExecuting(ActionExecutingContext context)
2323
{
2424
var request = context.HttpContext.Request;
25-
if (IsJsonApiRequest(request) && request.Method == "PATCH" || request.Method == "POST")
25+
if (IsJsonApiRequest(request) && (request.Method == "PATCH" || request.Method == "POST"))
2626
{
2727
var deserializedType = context.ActionArguments.FirstOrDefault().Value?.GetType();
2828
var targetType = context.ActionDescriptor.Parameters.FirstOrDefault()?.ParameterType;

0 commit comments

Comments
 (0)