Fix redirect description about HEAD (#1520)
* Fix redirect description about HEAD * Apply suggestions from code review Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
This commit is contained in:
parent
e05a5372eb
commit
ea5ffce14f
@ -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.
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user