Answer the question
In order to leave comments, you need to log in
How to force Laravel to return Content-Type JSON?
How to force laravel to set Content-Type header "application/json; charset=UTF-8"? I also do it through middleware:
public function handle($request, Closure $next) {
$request->headers->set('Content-Type', 'application/json; charset=UTF-8');
return $next($request);
}
return response()->json($result)->header('Content-Type', 'application/json; charset=UTF-8');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question