Closed ematipico closed 1 week ago
Latest commit: 1fd52385c225daf8c9465aa9eab3d1d09c1cfd2e
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Comparing fix/middleware-dev
(1fd5238) with main
(e723e9e)
✅ 1
untouched benchmarks
Changes
Closes https://github.com/withastro/astro/issues/12391 Closes PLT-2627
The middleware is called even when a user doesn't have a route that doesn't match an existing FS route. Users can return a
Response
that isn't a 404.The dev server didn't know that, so this PR fixes it.
To understand this use case, I decoded to add a tiny logic to our no-op middleware, which is used only when the user doesn't have a middleware. The no-op middleware adds an arbitrary header. If header isn't present, it means that the user have their own middleware, so we need to return any status returned by the
.render
function.Testing
Added two new test cases
Docs
N/A