diff --git a/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php b/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php index 8037bd55ff6f..cc001925543a 100644 --- a/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php +++ b/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php @@ -41,23 +41,7 @@ public function isJson() */ public function expectsJson() { - return ($this->ajax() && ! $this->pjax() && $this->wantsAnyContentType()) || $this->wantsJson(); - } - - /** - * Determine if the current request is asking for any content type in return. - * - * @return bool - */ - public function wantsAnyContentType() - { - $acceptable = $this->getAcceptableContentTypes(); - - if (count($acceptable) === 0) { - return true; - } - - return isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*'); + return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); } /** @@ -134,6 +118,20 @@ public function prefers($contentTypes) } } + /** + * Determine if the current request accepts any content type in return. + * + * @return bool + */ + public function acceptsAnyContentType() + { + $acceptable = $this->getAcceptableContentTypes(); + + return count($acceptable) === 0 || ( + isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*') + ); + } + /** * Determines whether a request accepts JSON. *