Open Alerion opened 3 years ago
If you want to the change, feel free to open a PR. Otherwise, maybe I can take a look in the following days.
As a workaround, I think using a multidict should work:
from multidict import CIMultiDict # already installed with async-asgi-testclient
resp = await client.post(
"/upload",
files=CIMultiDict([("file", "DATA"), ("file", "MORE DATA")])
)
Thank you for response. This works good for me. So you can just add an example to documentation.
response = await app_client.post_and_check(
url,
files=CIMultiDict([
("doc_id", doc_id),
("language_code", "en"),
("files", ("file1.png", file1, "image/png")),
("files", ("file2.jpg", file2, "image/jpeg")),
])
)
Allow using a tuple for
files
argument to pass few files with the same name.This is required to test these endpoints https://fastapi.tiangolo.com/tutorial/request-files/#multiple-file-uploads
Example for
requests
module: https://stackoverflow.com/a/20769921