Skip to content

Rfc7231ProblemDetailsWriter.CanWrite Logic Is Inverted #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
kramnos opened this issue Aug 10, 2023 · 0 comments · Fixed by #1018
Closed
1 task done

Rfc7231ProblemDetailsWriter.CanWrite Logic Is Inverted #1015

kramnos opened this issue Aug 10, 2023 · 0 comments · Fixed by #1018
Assignees

Comments

@kramnos
Copy link

kramnos commented Aug 10, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

As diagnosed here, it has been determined that the conditional logic inside the CanWrite method of Rfc7231ProblemDetailsWriter should be as follows:

if (acceptHeaderValue.IsSubsetOf(jsonMediaType) ||
    acceptHeaderValue.IsSubsetOf(problemDetailsJsonMediaType))
{
    return true;
}

This should allow problem details responses to be correctly emitted in the case where the incoming media type is more specific than the known media types, as is the case when an API version is included in the header, e.g. application/json; v=1.0.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants