#2934152: ContentTypeHeaderMatcher should not run for GET, HEAD, OPTIONS or TRACE requests improved ContentTypeHeaderMatcher's logic. It's a correct bugfix. But over at #2934149-19: [>=8.5] JSON API routes not specifying _content_type_format route requirement, resulting in bad DX we just noticed that there is another bug/oversight: DELETE requests. DELETE requests never have a request body. And so it doesn't make sense to require a Content-Type request header either.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new604 bytes

Failing test.

wim leers’s picture

Assigned: wim leers » Unassigned
StatusFileSize
new1011 bytes
new1.56 KB

And the fix.

The last submitted patch, 2: 2971012-2.patch, failed testing. View results

borisson_’s picture

This has test-coverage and looks to be really simple. I'm not to sure about the documentation. I think it'd be better do do something like this:

    // The Content-type header does not make sense on GET or DELETE requests, 
    // they do not carry any content. Nothing to filter in this case. Same
    // for all other safe methods.

However, It's just a suggestion.

wim leers’s picture

StatusFileSize
new1.13 KB
new1.68 KB

#5: I knew that comment was off! Thanks 🙏

Fixed!

P.S.: thank you very much for the review! How did you find this issue so fast!? 😲

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

That looks better!

I had some time and was looking at the needs review queue to see if I could help with any of the open issues.

wim leers’s picture

I had some time and was looking at the needs review queue to see if I could help with any of the open issues.

<3

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 246a31c42f to 8.6.x and e3004ccad6 to 8.5.x. Thanks!

  • alexpott committed 246a31c on 8.6.x
    Issue #2971012 by Wim Leers, borisson_: ContentTypeHeaderMatcher should...

  • alexpott committed e3004cc on 8.5.x
    Issue #2971012 by Wim Leers, borisson_: ContentTypeHeaderMatcher should...
wim leers’s picture

:O

This was one of my fastest core commits EVER. Thank you so much @alexpott!

wim leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.