Skip to content

Commit

Permalink
Merge pull request #36 from TheDragonCode/andrey-helldar-patch-1
Browse files Browse the repository at this point in the history
Fixed header setting
  • Loading branch information
andrey-helldar authored Oct 23, 2023
2 parents 898ca29 + 3a702b3 commit b7a5ee6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Middlewares/SetHeaderMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ class SetHeaderMiddleware
{
public function handle(Request $request, Closure $next)
{
$this->set($request);

return $next($request);
return $this->set(
$next($this->set($request))
);
}

protected function set(Request $request)
protected function set($request)
{
$response->headers->set(Header::ACCEPT, 'application/json');
if (! $request->headers->has(Header::ACCEPT)) {
$request->headers->set(Header::ACCEPT, 'application/json');
}

return $request;
}
}

0 comments on commit b7a5ee6

Please sign in to comment.