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

[8.x] Make accept header comparison case-insensitive #39413

Conversation

kunalray1993
Copy link
Contributor

@kunalray1993 kunalray1993 commented Oct 29, 2021

This pull request is for the issue mentioned in the #39411, that the $request->accepts method is currently allowing only case sensitive checking.

This pull request will convert both variables to lowercase before making the comparison. By doing so, the APPLICATION/JSON or APPLICATION/* header can match with any letter case in the code.

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

@s-patompong
Copy link
Contributor

Maybe change the RFC link since that one is for MIME :)

The one for Accept header is at https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.1.

@GrahamCampbell GrahamCampbell changed the title Make accept header comparison case-insensitive [8.x] Make accept header comparison case-insensitive Oct 29, 2021
@taylorotwell taylorotwell merged commit 85a8549 into laravel:8.x Oct 29, 2021
@kunalray1993 kunalray1993 deleted the feat/request-accepts-method-case-insensitive-checking branch October 29, 2021 13:44
chu121su12 pushed a commit to chu121su12/framework that referenced this pull request Oct 30, 2021
* Make accept header comparison case-insensitive

* Update comment and ref link

* Update InteractsWithContentTypes.php

Co-authored-by: Taylor Otwell <[email protected]>
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.

3 participants