You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 67d742c
Browse filesBrowse the repository at this point in the historyBrowse files
feat: follow redirects under the response body cap (#152)
* feat: follow redirects under the response body cap
With max_response_body_bytes set and follow_redirects=True, httpware now
follows redirects itself, closing intermediate responses unread and
capping only the final one, instead of rejecting the combination.
* test: assert auth on each redirect hop; docs: state the exact Authorization rule
* test: contrast intermediate redirect body reads with and without a cap
Copy file name to clipboardExpand all lines: docs/errors.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,7 +186,7 @@ Unlike `DecodeError`, this error is raised before the request is sent.
186
186
187
187
## `ResponseTooLargeError`
188
188
189
-
Both clients accept `max_response_body_bytes: int | None = None`. By default there is no limit. When it is set, a response body larger than the cap raises `ResponseTooLargeError` instead of being returned, whatever the status: a `200` trips it as easily as a `500`. The cap counts decoded bytes, after decompression. It applies to `send()` and the verb methods, and to the error body that `stream()` reads before raising a `StatusError`. Bytes you read yourself while iterating a `stream()` are never capped. Setting the cap together with`follow_redirects=True`, on the client or on a passed `httpx2_client`, raises `ValueError`, because `httpx2`reads every intermediate redirect body without the cap.
189
+
Both clients accept `max_response_body_bytes: int | None = None`. By default there is no limit. When it is set, a response body larger than the cap raises `ResponseTooLargeError` instead of being returned, whatever the status: a `200` trips it as easily as a `500`. The cap counts decoded bytes, after decompression. It applies to `send()` and the verb methods, and to the error body that `stream()` reads before raising a `StatusError`. Bytes you read yourself while iterating a `stream()` are never capped. With a cap set and`follow_redirects=True`, httpware follows the redirects itself and caps only the final response. It closes each intermediate redirect response without reading its body, so the responses in `response.history` have no content. Client `auth` is sent to the first URL only. `httpx2`keeps its `Authorization` header on a redirect within the same origin or from `http` to `https` on the same host, and drops it otherwise.
0 commit comments