Skip to content

Commit 3b750c4

Browse files
author
Jose Rodriguez
committed
fix: Makes Accept header more compatible with $request->wantsJson()
1 parent 21b2cb0 commit 3b750c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Http/Middleware/EnforceExpectsJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class EnforceExpectsJson
1313
*/
1414
public function handle(Request $request, $next)
1515
{
16-
if (! in_array('application/json', explode(',', $request->header('Accept')))) {
16+
if (strpos($request->header('Accept'), 'application/json') !== 0) {
1717
$request->headers->add(['Accept' => 'application/json,' . $request->header('Accept')]);
1818
}
1919

0 commit comments

Comments
 (0)