Skip to content

Commit

Permalink
Update Content Type Invoker
Browse files Browse the repository at this point in the history
  • Loading branch information
pentagonal authored Mar 24, 2018
1 parent 17f20fb commit 4390c62
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/NotFoundHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,16 @@ public function __invoke(
): ResponseInterface {
$contentType = $this->getContentType();
// if content type has not been set
// get it from Request
// get it from Request / Response
if (!$contentType) {
$contentType = $request->getHeaderLine('Content-Type')?: static::DEFAULT_CONTENT_TYPE;
$contentType = $response->getHeaderLine('Content-Type')?: (
$request->getHeaderLine('Content-Type')?: static::DEFAULT_CONTENT_TYPE
);
$this->setContentType($contentType);
}

// clean output buffers
$this->cleanOutputBuffer();
return $this
->getOutputResponse($request, $response)
->withHeader('Content-Type', $contentType);
return $this->getOutputResponse($request, $response);
}
}

0 comments on commit 4390c62

Please sign in to comment.