NotFound not content switching
Version: Slim 3.7.0
There is an error in Slim/Slim/Handlers/NotFound.php on line 42
$contentType = $this->determineContentType($request); looks like it should actually be $contentType = $request->getContentType($request); To return the not found page in the same format as the request.
When an invalid page is requested with the header application/json a return type of text/html is given.
With a quick look through some of the other page like NotAllowed.php, they seem to have the same issue.
I'm not sure what this is about.
Can you give us some details on the problem you are having?
The determineContentType() method (link) does get the content-type from the request, but Slim can only handle so many content types (note the recommendation in the docblock to use willdurand/negotiation if your needs are more complex).
@geggleto
When an invalid page is requested with the header application/json a return type of text/html is given.
It looks like the regex the determineContentType() method is using only matches content types with +json, so text/html is returned when application/json is provided. Improved regex would solve this issue.