Skip to content

Commit

Permalink
Note that 307 redirects aren't followed in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Dec 3, 2020
1 parent 47958c3 commit d6085e2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,24 @@ impl AgentBuilder {
///
/// If the redirect count hits this limit (and it's > 0), TooManyRedirects is returned.
///
/// WARNING: for 307 and 308 redirects, this value is ignored for methods that have a body.
/// You must handle 307 redirects yourself when sending a PUT, POST, PATCH, or DELETE request.
///
/// ```
/// # fn main() -> Result<(), ureq::Error> {
/// # ureq::is_test(true);
/// let result = ureq::builder()
/// .redirects(1)
/// .build()
/// .get("http://httpbin.org/redirect/3")
/// .call();
/// .get("http://httpbin.org/status/301")
/// .error_on_non_2xx(false)
/// .call()?;
/// assert_ne!(result.status(), 301);
///
/// let result = ureq::put("http://httpbin.org/status/307")
/// .error_on_non_2xx(false)
/// .send_bytes(b"some data")?;
/// assert_eq!(result.status(), 308);
/// # Ok(())
/// # }
/// ```
Expand Down

0 comments on commit d6085e2

Please sign in to comment.