http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.45k stars 119 forks source link

http-types::Response::new might panic #348

Open mihai-dinculescu opened 1 year ago

mihai-dinculescu commented 1 year ago

The current implementation of http-types::Response::new will panic on non-standard error codes such as the 52x ones returned by Cloudflare.

It looks like instead of returning an Ok(Response::new(res.into())), the send function should first test the StatusCode with StatusCode::try_from::<u16>.

I have also created an issue in http-types.