Spaces:
Running
Running
Omit host from header
Browse files
app.py
CHANGED
@@ -24,10 +24,9 @@ def get_token() -> str:
|
|
24 |
)
|
25 |
|
26 |
|
27 |
-
def get_headers(
|
28 |
return {
|
29 |
"Authorization": f"Bearer {get_token()}",
|
30 |
-
"Host": host,
|
31 |
"Accept": "application/json",
|
32 |
"Content-Type": "application/json",
|
33 |
}
|
@@ -35,7 +34,7 @@ def get_headers(host: str) -> dict:
|
|
35 |
|
36 |
def proxy(request: httpx.Request, model_info: dict) -> httpx.Request:
|
37 |
request.url = request.url.copy_with(path=model_info["endpoint"])
|
38 |
-
request.headers.update(get_headers(
|
39 |
return request
|
40 |
|
41 |
|
|
|
24 |
)
|
25 |
|
26 |
|
27 |
+
def get_headers() -> dict:
|
28 |
return {
|
29 |
"Authorization": f"Bearer {get_token()}",
|
|
|
30 |
"Accept": "application/json",
|
31 |
"Content-Type": "application/json",
|
32 |
}
|
|
|
34 |
|
35 |
def proxy(request: httpx.Request, model_info: dict) -> httpx.Request:
|
36 |
request.url = request.url.copy_with(path=model_info["endpoint"])
|
37 |
+
request.headers.update(get_headers())
|
38 |
return request
|
39 |
|
40 |
|