42 $acceptHeader =
$request->getHeaderLine(
'Accept');
43 $selectedContentTypes = array_intersect(explode(
',', $acceptHeader), $this->knownContentTypes);
45 if (count($selectedContentTypes)) {
46 return current($selectedContentTypes);
50 if (preg_match(
'/\+(json|xml)/', $acceptHeader, $matches)) {
51 $mediaType =
'application/' . $matches[1];
52 if (in_array($mediaType, $this->knownContentTypes)) {
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
Abstract Slim application handler.
determineContentType(ServerRequestInterface $request)
Determine which content type we know about is wanted using Accept header.
Representation of an incoming, server-side HTTP request.
Slim Framework (https://slimframework.com)