feat(http-request-executor): enhance file handling in HTTP requests (#9944)

This commit is contained in:
-LAN-
2024-10-28 17:51:01 +08:00
committed by GitHub
parent 7056009b6a
commit 4da0b70694
2 changed files with 7 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ class Executor:
params: Mapping[str, str] | None
content: str | bytes | None
data: Mapping[str, Any] | None
files: Mapping[str, bytes] | None
files: Mapping[str, tuple[str | None, bytes, str]] | None
json: Any
headers: dict[str, str]
auth: HttpRequestNodeAuthorization
@@ -141,7 +141,11 @@ class Executor:
files = {k: self.variable_pool.get_file(selector) for k, selector in file_selectors.items()}
files = {k: v for k, v in files.items() if v is not None}
files = {k: variable.value for k, variable in files.items()}
files = {k: file_manager.download(v) for k, v in files.items() if v.related_id is not None}
files = {
k: (v.filename, file_manager.download(v), v.mime_type or "application/octet-stream")
for k, v in files.items()
if v.related_id is not None
}
self.data = form_data
self.files = files