fix(http): force multipart/form-data even without files(#20322)

pull/20323/head
kimtaewoong 1 year ago
parent f233a64eb5
commit 00d446d951

@ -235,6 +235,10 @@ class Executor:
files[key].append(file_tuple)
# convert files to list for httpx request
# If there are no actual files, we still need to force httpx to use `multipart/form-data`.
# This is achieved by inserting a harmless placeholder file that will be ignored by the server.
if not files:
self.files = [("__multipart_placeholder__", ("", b"", "application/octet-stream"))]
if files:
self.files = []
for key, file_tuples in files.items():

Loading…
Cancel
Save