Skip to content

Commit 1e68c60

Browse files
authored
pop the item "Host" in the efficient way
Use `headers.pop("Host", None)` instead of a `if` statement. Signed-off-by: 黃昕暐 <[email protected]>
1 parent 822b340 commit 1e68c60

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

python-ecosys/requests/requests/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ def request(
181181
if redirect:
182182
s.close()
183183
# use the Host in the redirect URL
184-
if "Host" in headers:
185-
headers.pop("Host")
184+
headers.pop("Host", None)
186185
if status in [301, 302, 303]:
187186
return request("GET", redirect, None, None, headers, stream)
188187
else:

0 commit comments

Comments
 (0)