File tree Expand file tree Collapse file tree
src/Illuminate/Http/Concerns Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,23 +41,7 @@ public function isJson()
4141 */
4242 public function expectsJson ()
4343 {
44- return ($ this ->ajax () && ! $ this ->pjax () && $ this ->wantsAnyContentType ()) || $ this ->wantsJson ();
45- }
46-
47- /**
48- * Determine if the current request is asking for any content type in return.
49- *
50- * @return bool
51- */
52- public function wantsAnyContentType ()
53- {
54- $ acceptable = $ this ->getAcceptableContentTypes ();
55-
56- if (count ($ acceptable ) === 0 ) {
57- return true ;
58- }
59-
60- return isset ($ acceptable [0 ]) && ($ acceptable [0 ] === '*/* ' || $ acceptable [0 ] === '* ' );
44+ return ($ this ->ajax () && ! $ this ->pjax () && $ this ->acceptsAnyContentType ()) || $ this ->wantsJson ();
6145 }
6246
6347 /**
@@ -134,6 +118,20 @@ public function prefers($contentTypes)
134118 }
135119 }
136120
121+ /**
122+ * Determine if the current request accepts any content type in return.
123+ *
124+ * @return bool
125+ */
126+ public function acceptsAnyContentType ()
127+ {
128+ $ acceptable = $ this ->getAcceptableContentTypes ();
129+
130+ return count ($ acceptable ) === 0 || (
131+ isset ($ acceptable [0 ]) && ($ acceptable [0 ] === '*/* ' || $ acceptable [0 ] === '* ' )
132+ );
133+ }
134+
137135 /**
138136 * Determines whether a request accepts JSON.
139137 *
You can’t perform that action at this time.
0 commit comments