Skip to content

Commit

Permalink
expects json
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 22, 2016
1 parent cc60121 commit d33d33f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected function convertValidationExceptionToResponse(ValidationException $e,

$errors = $e->validator->errors()->getMessages();

if ($request->probablyWantsJson()) {
if ($request->expectsJson()) {
return response()->json($errors, 422);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Http/FormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function failedAuthorization()
*/
public function response(array $errors)
{
if ($this->probablyWantsJson()) {
if ($this->expectsJson()) {
return new JsonResponse($errors, 422);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Validation/ValidatesRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function throwValidationException(Request $request, $validator)
*/
protected function buildFailedValidationResponse(Request $request, array $errors)
{
if ($request->probablyWantsJson()) {
if ($request->expectsJson()) {
return new JsonResponse($errors, 422);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public function isJson()
*
* @return bool
*/
public function probablyWantsJson()
public function expectsJson()
{
return ($this->ajax() && ! $this->pjax()) || $this->wantsJson();
}
Expand Down

0 comments on commit d33d33f

Please sign in to comment.