test_redirects.py
This file
Path
tests/client/test_redirects.py
292 lines · 11.1 KiB · Python
Last changed by
Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0
History of this fileTake it
Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 1–5why, one step back1import json2from urllib.parse import parse_qs34import pytest5Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 6why, one step back6from httpx import (Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 7why, one step back7 URL,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 8why, one step back8 AsyncClient,Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
lines 9–11why, one step back9 AsyncDispatcher,10 AsyncRequest,11 AsyncResponse,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 12why, one step back12 CertTypes,Tighten up response.next() (#297)Florimond Mancabefore adoptiona464627
line 13why, one step back13 NotRedirectResponse,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 14–15why, one step back14 RedirectBodyUnavailable,15 RedirectLoop,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 16why, one step back16 TimeoutTypes,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 17why, one step back17 TooManyRedirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 18why, one step back18 VerifyTypes,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 19–22why, one step back19 codes,20)2122Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 23why, one step back23class MockDispatch(AsyncDispatcher):Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 24–25why, one step back24 async def send(25 self,Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 26why, one step back26 request: AsyncRequest,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 27–29why, one step back27 verify: VerifyTypes = None,28 cert: CertTypes = None,29 timeout: TimeoutTypes = None,Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 30why, one step back30 ) -> AsyncResponse:Tighten up response.next() (#297)Florimond Mancabefore adoptiona464627
lines 31–34why, one step back31 if request.url.path == "/no_redirect":32 return AsyncResponse(codes.OK, request=request)3334 elif request.url.path == "/redirect_301":Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 35why, one step back35 status_code = codes.MOVED_PERMANENTLYMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 36why, one step back36 headers = {"location": "https://example.org/"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 37why, one step back37 return AsyncResponse(status_code, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 38–39why, one step back3839 elif request.url.path == "/redirect_302":Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 40why, one step back40 status_code = codes.FOUNDMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 41why, one step back41 headers = {"location": "https://example.org/"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 42why, one step back42 return AsyncResponse(status_code, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 43–44why, one step back4344 elif request.url.path == "/redirect_303":Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 45why, one step back45 status_code = codes.SEE_OTHERMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 46why, one step back46 headers = {"location": "https://example.org/"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 47why, one step back47 return AsyncResponse(status_code, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 48–50why, one step back4849 elif request.url.path == "/relative_redirect":50 headers = {"location": "/"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 51why, one step back51 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 52–54why, one step back5253 elif request.url.path == "/no_scheme_redirect":54 headers = {"location": "//example.org/"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 55why, one step back55 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 56–60why, one step back5657 elif request.url.path == "/multiple_redirects":58 params = parse_qs(request.url.query)59 count = int(params.get("count", "0")[0])60 redirect_count = count - 1Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 61why, one step back61 code = codes.SEE_OTHER if count else codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 62–65why, one step back62 location = "/multiple_redirects"63 if redirect_count:64 location += "?count=" + str(redirect_count)65 headers = {"location": location} if count else {}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 66why, one step back66 return AsyncResponse(code, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 67–69why, one step back6768 if request.url.path == "/redirect_loop":69 headers = {"location": "/redirect_loop"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 70why, one step back70 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 71–73why, one step back7172 elif request.url.path == "/cross_domain":73 headers = {"location": "https://example.org/cross_domain_target"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 74why, one step back74 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 75–78why, one step back7576 elif request.url.path == "/cross_domain_target":77 headers = dict(request.headers.items())78 content = json.dumps({"headers": headers}).encode()Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 79why, one step back79 return AsyncResponse(codes.OK, content=content, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 80–83why, one step back8081 elif request.url.path == "/redirect_body":82 await request.read()83 headers = {"location": "/redirect_body_target"}Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
lines 84–86why, one step back84 return AsyncResponse(85 codes.PERMANENT_REDIRECT, headers=headers, request=request86 )Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 87why, one step back87Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0
lines 88–92why, one step back88 elif request.url.path == "/redirect_no_body":89 await request.read()90 headers = {"location": "/redirect_body_target"}91 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)92Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 93–94why, one step back93 elif request.url.path == "/redirect_body_target":94 content = await request.read()Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0
lines 95–96why, one step back95 headers = dict(request.headers.items())96 body = json.dumps({"body": content.decode(), "headers": headers}).encode()Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 97why, one step back97 return AsyncResponse(codes.OK, content=body, request=request)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 98why, one step back98Remove "Host" header on redirects if URL origin has changed (#199)Yeray Diaz Diazbefore adoption95dad24
lines 99–109why, one step back99 elif request.url.path == "/cross_subdomain":100 if request.headers["host"] != "www.example.org":101 headers = {"location": "https://www.example.org/cross_subdomain"}102 return AsyncResponse(103 codes.PERMANENT_REDIRECT, headers=headers, request=request104 )105 else:106 return AsyncResponse(107 codes.OK, content=b"Hello, world!", request=request108 )109Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 110why, one step back110 return AsyncResponse(codes.OK, content=b"Hello, world!", request=request)Tighten up response.next() (#297)Florimond Mancabefore adoptiona464627
lines 111–119why, one step back111112113async def test_no_redirect(backend):114 client = AsyncClient(dispatch=MockDispatch(), backend=backend)115 url = "https://example.com/no_redirect"116 response = await client.get(url)117 assert response.status_code == 200118 with pytest.raises(NotRedirectResponse):119 await response.next()Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 120–121why, one step back120121Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 122–123why, one step back122async def test_redirect_301(backend):123 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 124why, one step back124 response = await client.post("https://example.org/redirect_301")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 125why, one step back125 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 126–129why, one step back126 assert response.url == URL("https://example.org/")127 assert len(response.history) == 1128129Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 130–131why, one step back130async def test_redirect_302(backend):131 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 132why, one step back132 response = await client.post("https://example.org/redirect_302")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 133why, one step back133 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 134–137why, one step back134 assert response.url == URL("https://example.org/")135 assert len(response.history) == 1136137Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 138–139why, one step back138async def test_redirect_303(backend):139 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 140why, one step back140 response = await client.get("https://example.org/redirect_303")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 141why, one step back141 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 142–145why, one step back142 assert response.url == URL("https://example.org/")143 assert len(response.history) == 1144145Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 146–147why, one step back146async def test_disallow_redirects(backend):147 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
lines 148–149why, one step back148 response = await client.post(149 "https://example.org/redirect_303", allow_redirects=FalseMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 150why, one step back150 )Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 151why, one step back151 assert response.status_code == codes.SEE_OTHERMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 152why, one step back152 assert response.url == URL("https://example.org/redirect_303")Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
line 153why, one step back153 assert response.is_redirect is TrueMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 154–156why, one step back154 assert len(response.history) == 0155156 response = await response.next()Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 157why, one step back157 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 158why, one step back158 assert response.url == URL("https://example.org/")Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
line 159why, one step back159 assert response.is_redirect is FalseMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 160–162why, one step back160 assert len(response.history) == 1161162Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 163–164why, one step back163async def test_relative_redirect(backend):164 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 165why, one step back165 response = await client.get("https://example.org/relative_redirect")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 166why, one step back166 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 167–170why, one step back167 assert response.url == URL("https://example.org/")168 assert len(response.history) == 1169170Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 171–172why, one step back171async def test_no_scheme_redirect(backend):172 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 173why, one step back173 response = await client.get("https://example.org/no_scheme_redirect")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 174why, one step back174 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 175–178why, one step back175 assert response.url == URL("https://example.org/")176 assert len(response.history) == 1177178Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 179–180why, one step back179async def test_fragment_redirect(backend):180 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 181why, one step back181 response = await client.get("https://example.org/relative_redirect#fragment")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 182why, one step back182 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 183–186why, one step back183 assert response.url == URL("https://example.org/#fragment")184 assert len(response.history) == 1185186Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 187–188why, one step back187async def test_multiple_redirects(backend):188 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 189why, one step back189 response = await client.get("https://example.org/multiple_redirects?count=20")Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 190why, one step back190 assert response.status_code == codes.OKMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 191–192why, one step back191 assert response.url == URL("https://example.org/multiple_redirects")192 assert len(response.history) == 20Multipart support (#90)Tom Christiebefore adoption6a44b05
lines 193–198why, one step back193 assert response.history[0].url == URL(194 "https://example.org/multiple_redirects?count=20"195 )196 assert response.history[1].url == URL(197 "https://example.org/multiple_redirects?count=19"198 )Tweaks (#89)Tom Christiebefore adoption7c6fb5c
lines 199–200why, one step back199 assert len(response.history[0].history) == 0200 assert len(response.history[1].history) == 1Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 201–202why, one step back201202Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 203–204why, one step back203async def test_too_many_redirects(backend):204 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 205why, one step back205 with pytest.raises(TooManyRedirects):Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 206why, one step back206 await client.get("https://example.org/multiple_redirects?count=21")Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 207–208why, one step back207208Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 209–210why, one step back209async def test_too_many_redirects_calling_next(backend):210 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 211why, one step back211 url = "https://example.org/multiple_redirects?count=21"Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 212why, one step back212 response = await client.get(url, allow_redirects=False)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 213–217why, one step back213 with pytest.raises(TooManyRedirects):214 while response.is_redirect:215 response = await response.next()216217Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 218–219why, one step back218async def test_redirect_loop(backend):219 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 220why, one step back220 with pytest.raises(RedirectLoop):Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 221why, one step back221 await client.get("https://example.org/redirect_loop")Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 222–223why, one step back222223Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 224–225why, one step back224async def test_redirect_loop_calling_next(backend):225 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 226why, one step back226 url = "https://example.org/redirect_loop"Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 227why, one step back227 response = await client.get(url, allow_redirects=False)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 228–232why, one step back228 with pytest.raises(RedirectLoop):229 while response.is_redirect:230 response = await response.next()231232Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 233–234why, one step back233async def test_cross_domain_redirect(backend):234 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 235–236why, one step back235 url = "https://example.com/cross_domain"236 headers = {"Authorization": "abc"}Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 237why, one step back237 response = await client.get(url, headers=headers)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 238why, one step back238 assert response.url == URL("https://example.org/cross_domain_target")Add response.json()Tom Christiebefore adoption2116d44
line 239why, one step back239 assert "authorization" not in response.json()["headers"]Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 240–241why, one step back240241Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 242–243why, one step back242async def test_same_domain_redirect(backend):243 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 244–245why, one step back244 url = "https://example.org/cross_domain"245 headers = {"Authorization": "abc"}Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 246why, one step back246 response = await client.get(url, headers=headers)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 247why, one step back247 assert response.url == URL("https://example.org/cross_domain_target")Add response.json()Tom Christiebefore adoption2116d44
line 248why, one step back248 assert response.json()["headers"]["authorization"] == "abc"Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 249–250why, one step back249250Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 251why, one step back251async def test_body_redirect(backend):Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0
lines 252–254why, one step back252 """253 A 308 redirect should preserve the request body.254 """Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 255why, one step back255 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 256–257why, one step back256 url = "https://example.org/redirect_body"257 data = b"Example request body"Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 258why, one step back258 response = await client.post(url, data=data)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 259why, one step back259 assert response.url == URL("https://example.org/redirect_body_target")Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0
lines 260–274why, one step back260 assert response.json()["body"] == "Example request body"261 assert "content-length" in response.json()["headers"]262263264async def test_no_body_redirect(backend):265 """266 A 303 redirect should remove the request body.267 """268 client = AsyncClient(dispatch=MockDispatch(), backend=backend)269 url = "https://example.org/redirect_no_body"270 data = b"Example request body"271 response = await client.post(url, data=data)272 assert response.url == URL("https://example.org/redirect_body_target")273 assert response.json()["body"] == ""274 assert "content-length" not in response.json()["headers"]Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 275–276why, one step back275276Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 277–278why, one step back277async def test_cannot_redirect_streaming_body(backend):278 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 279–284why, one step back279 url = "https://example.org/redirect_body"280281 async def streaming_body():282 yield b"Example request body"283284 with pytest.raises(RedirectBodyUnavailable):Tidy up redirect testsTom Christiebefore adoptione40b0bf
line 285why, one step back285 await client.post(url, data=streaming_body())Remove "Host" header on redirects if URL origin has changed (#199)Yeray Diaz Diazbefore adoption95dad24
lines 286–287why, one step back286287Refactor client functionality into middleware (#268)Florimond Mancabefore adoption40e6e8c
line 288why, one step back288async def test_cross_subdomain_redirect(backend):Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 289why, one step back289 client = AsyncClient(dispatch=MockDispatch(), backend=backend)Remove "Host" header on redirects if URL origin has changed (#199)Yeray Diaz Diazbefore adoption95dad24
lines 290–292why, one step back290 url = "https://example.com/cross_subdomain"291 response = await client.get(url)292 assert response.url == URL("https://www.example.org/cross_subdomain")