mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
Switch from root_url
to request.url
in get_api_call_path()
(#10877)
* changes * add changeset * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
3a3d0d9388
commit
b19e8ad267
5
.changeset/public-zoos-obey.md
Normal file
5
.changeset/public-zoos-obey.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
feat:Switch from `root_url` to `request.url` in `get_api_call_path()`
|
@ -384,17 +384,16 @@ def get_api_call_path(request: fastapi.Request) -> str:
|
||||
"""
|
||||
queue_api_url = f"{API_PREFIX}/queue/join"
|
||||
generic_api_url = f"{API_PREFIX}/call"
|
||||
request_url = str(request.url)
|
||||
|
||||
root_url = get_request_url(request)
|
||||
|
||||
if root_url.endswith(queue_api_url):
|
||||
if request_url.endswith(queue_api_url):
|
||||
return queue_api_url
|
||||
|
||||
start_index = root_url.rfind(generic_api_url)
|
||||
start_index = request_url.rfind(generic_api_url)
|
||||
if start_index >= 0:
|
||||
return root_url[start_index : len(root_url)]
|
||||
return request_url[start_index : len(request_url)]
|
||||
|
||||
raise ValueError(f"Request url '{root_url}' has an unkown api call pattern.")
|
||||
raise ValueError(f"Request url '{request_url}' has an unkown api call pattern.")
|
||||
|
||||
|
||||
def get_root_url(
|
||||
|
Loading…
x
Reference in New Issue
Block a user