Skip to content
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

Make accept header comparison case-insensitive #39412

Closed
wants to merge 2 commits into from
Closed

Make accept header comparison case-insensitive #39412

wants to merge 2 commits into from

Conversation

s-patompong
Copy link
Contributor

@s-patompong s-patompong commented Oct 29, 2021

This issue #39411 mentioned that the accepts method is currently not case-insensitive.

This pull request will cast both variables to lowercase before making the comparison. By doing so, the APPLICATION/JSON header can match application/json in the code.

The new test method is added to the \Illuminate\Tests\Http\HttpRequestTest class for case-insensitive test.

@crynobone
Copy link
Member

crynobone commented Oct 29, 2021

The given RFC are for MIME. Are you certain that HTTP follows that? and why hasn't Symfony handle this already if that was the case?

@s-patompong
Copy link
Contributor Author

My bad, I forgot to recheck the RFC link (copied it from the issue).

I'll find more info regarding the accept header.

@s-patompong
Copy link
Contributor Author

It looks like the RFC doesn't mention the letter case requirement for the Accept field value at https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2.

However, it does state this below at https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.1.

Many of the request header fields for proactive negotiation use a common parameter, named "q" (case-insensitive).

If q is case-insensitive, maybe it's worth it to see the other fields as case-insensitive as well?

@s-patompong
Copy link
Contributor Author

Close this one since #39413 has more coverage :)

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

Successfully merging this pull request may close these issues.

2 participants