]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Fix redirect description about HEAD (#1520)
authorlaggardkernel <laggardkernel@users.noreply.github.com>
Sun, 21 Mar 2021 14:59:31 +0000 (22:59 +0800)
committerGitHub <noreply@github.com>
Sun, 21 Mar 2021 14:59:31 +0000 (15:59 +0100)
* Fix redirect description about HEAD

* Apply suggestions from code review

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
docs/compatibility.md
docs/quickstart.md

index 99faf432326fdb837f05cab6cb5bd5b1b861c4cc..b71bc38c775903ba3d93e9fdd2daa31778402a51 100644 (file)
@@ -124,6 +124,11 @@ On the other hand, HTTPX uses [HTTPCore](https://github.com/encode/httpcore) as
 
 `requests` omits `params` whose values are `None` (e.g. `requests.get(..., params={"foo": None})`). This is not supported by HTTPX.
 
+## HEAD redirection
+
+In `requests`, all top-level API follow redirects by default except `HEAD`.
+In consideration of consistency, we make `HEAD` follow redirects by default in HTTPX.
+
 ## Determining the next redirect request
 
 When using `allow_redirects=False`, the `requests` library exposes an attribute `response.next`, which can be used to obtain the next redirect request.
index 4f15549e717f7db9a57060f9a4fb68d6c2b157de..4afaff243068a503027b747a373d8820549077ad 100644 (file)
@@ -408,7 +408,8 @@ with additional API for accessing cookies by their domain or path.
 
 ## Redirection and History
 
-By default, HTTPX will follow redirects for anything except `HEAD` requests.
+By default, HTTPX will follow redirects for all HTTP methods.
+
 
 The `history` property of the response can be used to inspect any followed redirects.
 It contains a list of any redirect responses that were followed, in the order
@@ -436,16 +437,6 @@ You can modify the default redirection handling with the allow_redirects paramet
 []
 ```
 
-If you’re making a `HEAD` request, you can use this to enable redirection:
-
-```pycon
->>> r = httpx.head('http://github.com/', allow_redirects=True)
->>> r.url
-'https://github.com/'
->>> r.history
-[<Response [301 Moved Permanently]>]
-```
-
 ## Timeouts
 
 HTTPX defaults to including reasonable timeouts for all network operations,