reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

Propagate timeout from client to request early on

Open WaffleLapkin opened this issue 2 years ago • 0 comments

This allows not just setting, but also mutating the timeout via .timeout_mut().

For example:

let mut request = client.post(url).build()?;

// Increase timeout (without this PR, `timeout_mut()` always returns None)
*request.timeout_mut().get_or_insert(Duration::ZERO) += timeout;

let response = client.execute(request).await?;

I'm not sure if this is the right approach, but some way of increasing timeout would be very useful :)

WaffleLapkin avatar Feb 22 '22 17:02 WaffleLapkin