Spaces:
Runtime error
Runtime error
DeathDaDev
commited on
Commit
•
4e482de
1
Parent(s):
da32240
style: format code consistently and manage headers correctly in flask-app.py
Browse files- flask-app.py +9 -6
flask-app.py
CHANGED
@@ -14,14 +14,17 @@ def proxy(path):
|
|
14 |
resp = requests.request(
|
15 |
method=request.method,
|
16 |
url=url,
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
|
23 |
-
headers = [
|
24 |
-
|
|
|
|
|
25 |
|
26 |
response = app.response_class(
|
27 |
response=resp.content,
|
|
|
14 |
resp = requests.request(
|
15 |
method=request.method,
|
16 |
url=url,
|
17 |
+
headers={key: value for (key, value) in request.headers if key != 'Host'},
|
18 |
+
data=request.get_data(),
|
19 |
+
cookies=request.cookies,
|
20 |
+
allow_redirects=False
|
21 |
+
)
|
22 |
|
23 |
excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
|
24 |
+
headers = [
|
25 |
+
(name, value) for (name, value) in resp.raw.headers.items()
|
26 |
+
if name.lower() not in excluded_headers
|
27 |
+
]
|
28 |
|
29 |
response = app.response_class(
|
30 |
response=resp.content,
|