Skip to content

Conversation

tillkruss
Copy link
Contributor

@tillkruss tillkruss commented Aug 28, 2022

When the AbstractRouteCollection::handleMatchedRoute() throws a NotFoundHttpException, the generated response is never passed through Router::toResponse() which calls the Response::prepare() method.

The end result of this is that the when a non-existing route is called the response doesn't contain the Content-Type: text/html header and the response may not be rendered correctly, depending on whether the web server will "intelligently" add the Content-Type header.

I ran into this when running Octane using my own AWS Lambda handler that doesn't correct this, like vapor-core does.

@nunomaduro nunomaduro changed the title Call prepare() on HttpException responses [9.x] Call prepare() on HttpException responses Aug 29, 2022
@taylorotwell taylorotwell merged commit 45cd804 into 9.x Aug 29, 2022
@taylorotwell taylorotwell deleted the call-prepare-on-errors branch August 29, 2022 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants