reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

504 gateway timeout is not a timeout

Open djugei opened this issue 2 years ago • 2 comments

let response = gen_504_response();
let response = response.error_for_status().map_err(|e| e.is_timeout())
assert_eq!(response, Result::Err(true));

this currently panics, i would expect a gateway timeout to be a timeout.

djugei avatar Sep 25 '23 18:09 djugei

Hm, that's an interesting idea. I'd never thought about it. So far, is_timeout() means one of the ClientBuilder::*_timeout() options was the cause of the failure.

seanmonstar avatar Sep 27 '23 12:09 seanmonstar

then maybe it should be renamed to is_client_timeout, and/or the conversion of status to error should be removed? maybe thats too drastic.

one semi-related thing: its a bit of a footgun that requests return Response instead of some kind of Result<Response>, or at least (status, response). makes it very easy to accidentally ignore errors, or rather the api does not guide you through the semantics like it usually does in rust.

djugei avatar Oct 10 '23 08:10 djugei