Skip to content
Myr

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 file

Take it

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 1–5why, one step back
1import json
2from urllib.parse import parse_qs34import pytest5

Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b

line 6why, one step back
6from httpx import (

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 7why, one step back
7 URL,

Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0

line 8why, one step back
8 AsyncClient,

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

lines 9–11why, one step back
9 AsyncDispatcher,
10 AsyncRequest,11 AsyncResponse,

Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041

line 12why, one step back
12 CertTypes,

Tighten up response.next() (#297)Florimond Mancabefore adoptiona464627

line 13why, one step back
13 NotRedirectResponse,

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 14–15why, one step back
14 RedirectBodyUnavailable,
15 RedirectLoop,

Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041

line 16why, one step back
16 TimeoutTypes,

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 17why, one step back
17 TooManyRedirects,

Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041

line 18why, one step back
18 VerifyTypes,

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 19–22why, one step back
19 codes,
20)2122

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 23why, one step back
23class MockDispatch(AsyncDispatcher):

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 24–25why, one step back
24 async def send(
25 self,

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 26why, one step back
26 request: AsyncRequest,

Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041

lines 27–29why, one step back
27 verify: VerifyTypes = None,
28 cert: CertTypes = None,29 timeout: TimeoutTypes = None,

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 30why, one step back
30 ) -> AsyncResponse:

Tighten up response.next() (#297)Florimond Mancabefore adoptiona464627

lines 31–34why, one step back
31 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 back
35 status_code = codes.MOVED_PERMANENTLY

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 36why, one step back
36 headers = {"location": "https://example.org/"}

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 37why, one step back
37 return AsyncResponse(status_code, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 38–39why, one step back
38
39 elif request.url.path == "/redirect_302":

Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369

line 40why, one step back
40 status_code = codes.FOUND

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 41why, one step back
41 headers = {"location": "https://example.org/"}

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 42why, one step back
42 return AsyncResponse(status_code, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 43–44why, one step back
43
44 elif request.url.path == "/redirect_303":

Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369

line 45why, one step back
45 status_code = codes.SEE_OTHER

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 46why, one step back
46 headers = {"location": "https://example.org/"}

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 47why, one step back
47 return AsyncResponse(status_code, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 48–50why, one step back
48
49 elif request.url.path == "/relative_redirect":50 headers = {"location": "/"}

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 51why, one step back
51 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 52–54why, one step back
52
53 elif request.url.path == "/no_scheme_redirect":54 headers = {"location": "//example.org/"}

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 55why, one step back
55 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 56–60why, one step back
56
57 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 - 1

Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369

line 61why, one step back
61 code = codes.SEE_OTHER if count else codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 62–65why, one step back
62 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 back
66 return AsyncResponse(code, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 67–69why, one step back
67
68 if request.url.path == "/redirect_loop":69 headers = {"location": "/redirect_loop"}

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 70why, one step back
70 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 71–73why, one step back
71
72 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 back
74 return AsyncResponse(codes.SEE_OTHER, headers=headers, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 75–78why, one step back
75
76 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 back
79 return AsyncResponse(codes.OK, content=content, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 80–83why, one step back
80
81 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 back
84 return AsyncResponse(
85 codes.PERMANENT_REDIRECT, headers=headers, request=request86 )

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 87why, one step back
87

Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0

lines 88–92why, one step back
88 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)92

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 93–94why, one step back
93 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 back
95 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 back
97 return AsyncResponse(codes.OK, content=body, request=request)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 98why, one step back
98

Remove "Host" header on redirects if URL origin has changed (#199)Yeray Diaz Diazbefore adoption95dad24

lines 99–109why, one step back
99 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 )109

Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7

line 110why, one step back
110 return AsyncResponse(codes.OK, content=b"Hello, world!", request=request)

Tighten up response.next() (#297)Florimond Mancabefore adoptiona464627

lines 111–119why, one step back
111
112113async 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 back
120
121

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 122–123why, one step back
122async def test_redirect_301(backend):
123 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 124why, one step back
124 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 back
125 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 126–129why, one step back
126 assert response.url == URL("https://example.org/")
127 assert len(response.history) == 1128129

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 130–131why, one step back
130async def test_redirect_302(backend):
131 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 132why, one step back
132 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 back
133 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 134–137why, one step back
134 assert response.url == URL("https://example.org/")
135 assert len(response.history) == 1136137

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 138–139why, one step back
138async def test_redirect_303(backend):
139 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 140why, one step back
140 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 back
141 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 142–145why, one step back
142 assert response.url == URL("https://example.org/")
143 assert len(response.history) == 1144145

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 146–147why, one step back
146async def test_disallow_redirects(backend):
147 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

lines 148–149why, one step back
148 response = await client.post(
149 "https://example.org/redirect_303", allow_redirects=False

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 150why, one step back
150 )

Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369

line 151why, one step back
151 assert response.status_code == codes.SEE_OTHER

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 152why, one step back
152 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 back
153 assert response.is_redirect is True

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 154–156why, one step back
154 assert len(response.history) == 0
155156 response = await response.next()

Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369

line 157why, one step back
157 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 158why, one step back
158 assert response.url == URL("https://example.org/")

Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb

line 159why, one step back
159 assert response.is_redirect is False

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 160–162why, one step back
160 assert len(response.history) == 1
161162

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 163–164why, one step back
163async def test_relative_redirect(backend):
164 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 165why, one step back
165 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 back
166 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 167–170why, one step back
167 assert response.url == URL("https://example.org/")
168 assert len(response.history) == 1169170

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 171–172why, one step back
171async def test_no_scheme_redirect(backend):
172 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 173why, one step back
173 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 back
174 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 175–178why, one step back
175 assert response.url == URL("https://example.org/")
176 assert len(response.history) == 1177178

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 179–180why, one step back
179async def test_fragment_redirect(backend):
180 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 181why, one step back
181 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 back
182 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 183–186why, one step back
183 assert response.url == URL("https://example.org/#fragment")
184 assert len(response.history) == 1185186

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 187–188why, one step back
187async def test_multiple_redirects(backend):
188 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 189why, one step back
189 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 back
190 assert response.status_code == codes.OK

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 191–192why, one step back
191 assert response.url == URL("https://example.org/multiple_redirects")
192 assert len(response.history) == 20

Multipart support (#90)Tom Christiebefore adoption6a44b05

lines 193–198why, one step back
193 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 back
199 assert len(response.history[0].history) == 0
200 assert len(response.history[1].history) == 1

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 201–202why, one step back
201
202

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 203–204why, one step back
203async 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 back
205 with pytest.raises(TooManyRedirects):

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 206why, one step back
206 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 back
207
208

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 209–210why, one step back
209async 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 back
211 url = "https://example.org/multiple_redirects?count=21"

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 212why, one step back
212 response = await client.get(url, allow_redirects=False)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 213–217why, one step back
213 with pytest.raises(TooManyRedirects):
214 while response.is_redirect:215 response = await response.next()216217

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 218–219why, one step back
218async 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 back
220 with pytest.raises(RedirectLoop):

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 221why, one step back
221 await client.get("https://example.org/redirect_loop")

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 222–223why, one step back
222
223

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 224–225why, one step back
224async 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 back
226 url = "https://example.org/redirect_loop"

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 227why, one step back
227 response = await client.get(url, allow_redirects=False)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 228–232why, one step back
228 with pytest.raises(RedirectLoop):
229 while response.is_redirect:230 response = await response.next()231232

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 233–234why, one step back
233async 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 back
235 url = "https://example.com/cross_domain"
236 headers = {"Authorization": "abc"}

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 237why, one step back
237 response = await client.get(url, headers=headers)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 238why, one step back
238 assert response.url == URL("https://example.org/cross_domain_target")

Add response.json()Tom Christiebefore adoption2116d44

line 239why, one step back
239 assert "authorization" not in response.json()["headers"]

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 240–241why, one step back
240
241

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 242–243why, one step back
242async 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 back
244 url = "https://example.org/cross_domain"
245 headers = {"Authorization": "abc"}

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 246why, one step back
246 response = await client.get(url, headers=headers)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 247why, one step back
247 assert response.url == URL("https://example.org/cross_domain_target")

Add response.json()Tom Christiebefore adoption2116d44

line 248why, one step back
248 assert response.json()["headers"]["authorization"] == "abc"

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 249–250why, one step back
249
250

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 251why, one step back
251async def test_body_redirect(backend):

Merge pull request #310 from encode/drop-content-length-on-get-redirectsTom Christiebefore adoption33c5fe0

lines 252–254why, one step back
252 """
253 A 308 redirect should preserve the request body.254 """

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 255why, one step back
255 client = AsyncClient(dispatch=MockDispatch(), backend=backend)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

lines 256–257why, one step back
256 url = "https://example.org/redirect_body"
257 data = b"Example request body"

Tidy up redirect testsTom Christiebefore adoptione40b0bf

line 258why, one step back
258 response = await client.post(url, data=data)

Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144

line 259why, one step back
259 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 back
260 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 back
275
276

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 277–278why, one step back
277async 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 back
279 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 back
285 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 back
286
287

Refactor client functionality into middleware (#268)Florimond Mancabefore adoption40e6e8c

line 288why, one step back
288async def test_cross_subdomain_redirect(backend):

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 289why, one step back
289 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 back
290 url = "https://example.com/cross_subdomain"
291 response = await client.get(url)292 assert response.url == URL("https://www.example.org/cross_subdomain")