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

[5.6] Fix expectsJson returning true when explicitly expecting other content type #22506

Merged
merged 2 commits into from
Dec 29, 2017

Conversation

jn-jairo
Copy link
Contributor

The method $request->expectsJson() was returning true when explicitly expecting other content type.

Targeting master due the risk of a breaking change.

See the original PR #22459

@taylorotwell
Copy link
Member

What if no Accepts is set at all for an AJAX request?

@jn-jairo
Copy link
Contributor Author

jn-jairo commented Dec 26, 2017

@taylorotwell expectsJson will return false

Would you like to change this behavior and treat it as expecting any type?

It makes sense, following the logic of the function, to consider that an ajax request without a Accept header expects a response in JSON

*
* @return bool
*/
public function wantsAnyContentType()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better name for this would be acceptsAnyContentType.

@taylorotwell taylorotwell merged commit 3dc1dfe into laravel:master Dec 29, 2017
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.

None yet

3 participants