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

Return json on error for a json request #3285

Merged
merged 2 commits into from May 30, 2018
Merged

Conversation

nanaya
Copy link
Collaborator

@nanaya nanaya commented May 30, 2018

ajax only covers requests with X-Requested-With=XMLHttpRequest.
And change expectsJson to wantsJson. The former also includes ajax requests.

ajax only covers requests with `X-Requested-With=XMLHttpRequest`.
And change expectsJson to wantsJson. The former also includes ajax requests.
@notbakaneko
Copy link
Collaborator

notbakaneko commented May 30, 2018

Actually, why doesn't the html version of unauthenticated return 401 as well?

@@ -120,7 +120,7 @@ public function render($request, Exception $e)

protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
if ($request->wantsJson()) {

This comment was marked as off-topic.

@nanaya
Copy link
Collaborator Author

nanaya commented May 30, 2018

I vaguely remember browsers showing native auth dialog if returning 401.

@peppy peppy added this to the May 2018 milestone May 30, 2018
@peppy peppy merged commit afdd808 into ppy:master May 30, 2018
@nanaya nanaya deleted the json_return branch June 28, 2018 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants