Is there a way to set the content-type to 'application/json' for responses globally in SLIM 3?
I tried the following things which did not work:
$app->contentType('application/json');
$app->response->headers->set('Content-Type', 'application/json');
Middleware:
$app->add(function ($request, $response, $next) {
return $response->withHeader('Content-Type', 'application/json');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With