Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(routing): return correct status code for 500.astro and 404.astro #11308

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

ematipico
Copy link
Member

Changes

Closes #11306

This PR hardcodes the status code of the rendered pages 404.astro and 500.astro.

This issue was never evident because users were never able to see/catch the response emitted by these custom pages, but with the rewriting this was evident.

I updated the renderPage function to set a different status in case we attempt to render these particular routes.

Testing

Testing here is particularly difficult, because we are inside a rewriting cycle.

I locally tested that in const response = await next() the response holds a 404 or a 500 depending on where we're redirecting.

Docs

N/A

Copy link

changeset-bot bot commented Jun 21, 2024

🦋 Changeset detected

Latest commit: ce9b35b

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jun 21, 2024
@ematipico ematipico merged commit 44c61dd into main Jun 24, 2024
14 checks passed
@ematipico ematipico deleted the fix/rewriting-middle-status-code branch June 24, 2024 12:21
@astrobot-houston astrobot-houston mentioned this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewriting doesn't use HTTP status code from rewritten response
3 participants