This repository was archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 193
NotFoundHandler generateTemplatedResponse Content Type missing #647
Copy link
Copy link
Open
Description
I believe "Content-Type" header is missing from the newly created response object when a 404 error is handled.
/src/Handler/NotFoundHandler.php
/**
* Generates a response using a template.
*
* Template will receive the current request via the "request" variable.
*/
private function generateTemplatedResponse(
TemplateRendererInterface $renderer,
ServerRequestInterface $request
) : ResponseInterface {
$response = ($this->responseFactory)()->withStatus(StatusCodeInterface::STATUS_NOT_FOUND);
$response->getBody()->write(
$renderer->render($this->template, ['request' => $request, 'layout' => $this->layout])
);
return $response;
}Should be
/**
* Generates a response using a template.
*
* Template will receive the current request via the "request" variable.
*/
private function generateTemplatedResponse(
TemplateRendererInterface $renderer,
ServerRequestInterface $request
) : ResponseInterface {
$response = ($this->responseFactory)()
->withHeader('Content-Type', 'text/html')
->withStatus(StatusCodeInterface::STATUS_NOT_FOUND);
$response->getBody()->write(
$renderer->render($this->template, ['request' => $request, 'layout' => $this->layout])
);
return $response;
}Metadata
Metadata
Assignees
Labels
No labels