Skip to content

feat(status): Expose helper for invalid HTTP status codes - #894

Open
Ninja3047 wants to merge 1 commit into
hyperium:masterfrom
Ninja3047:fix-http-error-code
Open

Ninja3047 wants to merge 1 commit into
hyperium:masterfrom
Ninja3047:fix-http-error-code

Conversation

@Ninja3047

@Ninja3047 Ninja3047 commented Dec 1, 2026 •

Copy link
Copy Markdown

RFC 9110 states that clients that receive codes between 500 and 999 should treat that as invalid.

https://www.rfc-editor.org/rfc/rfc9110.html#section-15

A client that receives a response with an invalid status code SHOULD process the response as if it had a 5xx (Server Error) status code.

@seanmonstar

Copy link
Copy Markdown
Member

Thanks for the idea! The full paragraph in the RFC says:

Values outside the range 100..599 are invalid. Implementations often use three-digit integer values outside of that range (i.e., 600..999) for internal communication of non-HTTP status (e.g., library errors). A client that receives a response with an invalid status code SHOULD process the response as if it had a 5xx (Server Error) status code.

I think it'd be more correct to add an is_invalid() (or similar naming). Then a client can decide for themselves if they "should" consider it a 500 or something else. I worry simply including it in the is_server_error() category will make it easier to distinguish the difference.

@Ninja3047

Copy link
Copy Markdown
Author

Yeah I can do that, downstream consumers (like reqwest) will probably need to be updated in that case to also handle invalid codes properly.

@Ninja3047
Ninja3047 force-pushed the fix-http-error-code branch from 273a8ca to 21a9731 Compare December 1, 2026 15:33
@Ninja3047 Ninja3047 changed the title fix(status): Treat HTTP Status codes above 600 as server errors feat(status): Expose helper for invalid HTTP status codes Dec 1, 2026

This branch has not been deployed

No deployments
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