Skip to content

Conversation

@ascorbic
Copy link
Contributor

Changes

Currently if a user has a custom 404.astro or 500.astro we set the correct status code in the response, but not the correct status text, instead leaving the default OK. This PR ensures the correct text is set too.

Fixes #13259

Testing

Added tests

Docs

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2025

🦋 Changeset detected

Latest commit: 8135ef5

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 Mar 18, 2025

if (status) {
return new Response(body, { ...init, headers, status });
return new Response(body, { ...init, headers, status, statusText });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there's a custom status text? this would override it I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Good point. I suppose in theory someone might set a custom status in the custom error page. I'll change ti to only change it if it's "OK"

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 18, 2025

CodSpeed Performance Report

Merging #13457 will not alter performance

Comparing error-statustext (8135ef5) with main (5339f17)

Summary

✅ 6 untouched benchmarks

@ascorbic ascorbic merged commit 968e713 into main Mar 18, 2025
16 checks passed
@ascorbic ascorbic deleted the error-statustext branch March 18, 2025 16:57
@astrobot-houston astrobot-houston mentioned this pull request Mar 18, 2025
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.

Custom 404 page returns invalid 404 OK status in server mode

2 participants