Level 55
@dokolenko24cm you can create new middleware with `handle like this
public function handle($request, Closure $next)
{
return $next($request)->header('Content-Type', 'application/json');
}
and apply it to api routes
Also in your controllers you can force returning json by using json method of response object https://laravel.com/docs/9.x/responses#json-responses
eturn response()->json([...]);
1 like