mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 02:09:02 +08:00
fix httpx doesn't support stream parameter (#10859)
This commit is contained in:
parent
58a9d9eb9a
commit
ee1f14621a
@ -39,6 +39,7 @@ def make_request(method, url, max_retries=SSRF_DEFAULT_MAX_RETRIES, **kwargs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
retries = 0
|
retries = 0
|
||||||
|
stream = kwargs.pop("stream", False)
|
||||||
while retries <= max_retries:
|
while retries <= max_retries:
|
||||||
try:
|
try:
|
||||||
if dify_config.SSRF_PROXY_ALL_URL:
|
if dify_config.SSRF_PROXY_ALL_URL:
|
||||||
@ -52,6 +53,8 @@ def make_request(method, url, max_retries=SSRF_DEFAULT_MAX_RETRIES, **kwargs):
|
|||||||
response = client.request(method=method, url=url, **kwargs)
|
response = client.request(method=method, url=url, **kwargs)
|
||||||
|
|
||||||
if response.status_code not in STATUS_FORCELIST:
|
if response.status_code not in STATUS_FORCELIST:
|
||||||
|
if stream:
|
||||||
|
return response.iter_bytes()
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
logging.warning(f"Received status code {response.status_code} for URL {url} which is in the force list")
|
logging.warning(f"Received status code {response.status_code} for URL {url} which is in the force list")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user