Consider more rigorous handling of http::StatusCode conversion to StatusCode
- Dominant language
- Rust
- Stars
- 209
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
Right now conversion from `http::StatusCode` (which is just an `u16` in `100..=600` range) to `StatusCode` just expect()s the result for example here:
https://github.com/http-rs/http-types/blob/539638273de768a24354b65999ad9317b6659204/src/response.rs#L101-L103
this could cause a crash in response conversion for example here:
https://github.com/http-rs/http-types/blob/539638273de768a24354b65999ad9317b6659204/src/hyperium_http.rs#L123
if some server responds erroneously with some status that belongs to 100..=600 range but is not implemented in `StatusCode` enum (for example 229), the conversion `From> for Response` will panic despite it being `From` and not `TryFrom`
Contributor guide
Assessment
This issue has not been assessed yet.