|
6 | 6 | import pytest |
7 | 7 |
|
8 | 8 | import httpx |
9 | | -from httpx._utils import ( |
10 | | - URLPattern, |
11 | | - get_environment_proxies, |
12 | | -) |
| 9 | +from httpx._utils import URLPattern, get_environment_proxies |
13 | 10 |
|
14 | 11 |
|
15 | 12 | @pytest.mark.parametrize( |
@@ -115,62 +112,6 @@ def test_get_environment_proxies(environment, proxies): |
115 | 112 | assert get_environment_proxies() == proxies |
116 | 113 |
|
117 | 114 |
|
118 | | -def test_same_origin(): |
119 | | - origin = httpx.URL("https://example.com") |
120 | | - request = httpx.Request("GET", "HTTPS://EXAMPLE.COM:443") |
121 | | - |
122 | | - client = httpx.Client() |
123 | | - headers = client._redirect_headers(request, origin, "GET") |
124 | | - |
125 | | - assert headers["Host"] == request.url.netloc.decode("ascii") |
126 | | - |
127 | | - |
128 | | -def test_not_same_origin(): |
129 | | - origin = httpx.URL("https://example.com") |
130 | | - request = httpx.Request("GET", "HTTP://EXAMPLE.COM:80") |
131 | | - |
132 | | - client = httpx.Client() |
133 | | - headers = client._redirect_headers(request, origin, "GET") |
134 | | - |
135 | | - assert headers["Host"] == origin.netloc.decode("ascii") |
136 | | - |
137 | | - |
138 | | -def test_is_https_redirect(): |
139 | | - url = httpx.URL("https://example.com") |
140 | | - request = httpx.Request( |
141 | | - "GET", "http://example.com", headers={"Authorization": "empty"} |
142 | | - ) |
143 | | - |
144 | | - client = httpx.Client() |
145 | | - headers = client._redirect_headers(request, url, "GET") |
146 | | - |
147 | | - assert "Authorization" in headers |
148 | | - |
149 | | - |
150 | | -def test_is_not_https_redirect(): |
151 | | - url = httpx.URL("https://www.example.com") |
152 | | - request = httpx.Request( |
153 | | - "GET", "http://example.com", headers={"Authorization": "empty"} |
154 | | - ) |
155 | | - |
156 | | - client = httpx.Client() |
157 | | - headers = client._redirect_headers(request, url, "GET") |
158 | | - |
159 | | - assert "Authorization" not in headers |
160 | | - |
161 | | - |
162 | | -def test_is_not_https_redirect_if_not_default_ports(): |
163 | | - url = httpx.URL("https://example.com:1337") |
164 | | - request = httpx.Request( |
165 | | - "GET", "http://example.com:9999", headers={"Authorization": "empty"} |
166 | | - ) |
167 | | - |
168 | | - client = httpx.Client() |
169 | | - headers = client._redirect_headers(request, url, "GET") |
170 | | - |
171 | | - assert "Authorization" not in headers |
172 | | - |
173 | | - |
174 | 115 | @pytest.mark.parametrize( |
175 | 116 | ["pattern", "url", "expected"], |
176 | 117 | [ |
|
0 commit comments