Skip to content
Myr

Neater Host header logic on redirects (#1299)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent ed27682 · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:httpx/_client.py+4 added-1 removed
462 unmodified lines
463 if not same_origin(url, request.url):464 # Strip Authorization headers when responses are redirected away from465 # the origin.466 headers.pop("Authorization", None)467 headers["Host"] = url.authority467468 # Remove the Host header, so that a new one with be auto-populated on469 # the request instance.470 headers.pop("Host", None)471472 if method != request.method and method == "GET":473 # If we've switch to a 'GET' request, then strip any headers which474 # are only relevant to the request body.475 headers.pop("Content-Length", None)
1378 unmodified lines