You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to test uploading files to API server.
Using your test client, I wrote the test as below:
with (datadir/"image.png").open("rb") asfp:
files= {"image": ("sample.png", fp, "image/png")}
response=awaitclient.post("/api/upload_image", files=files)
But multipart file handling seems to have some error.
I don't think that decoding binary data of a file into str is possible.
if isinstance(value, bytes):
> value = value.decode("ascii")
E UnicodeDecodeError: 'ascii' codec can't decode byte 0x89 in position 0: ordinal not in range(128)
../../../../../.venv/lib/python3.7/site-packages/async_asgi_testclient/multipart.py:59: UnicodeDecodeError
The text was updated successfully, but these errors were encountered:
I'd like to test uploading files to API server.
Using your test client, I wrote the test as below:
But multipart file handling seems to have some error.
I don't think that decoding binary data of a file into str is possible.
The text was updated successfully, but these errors were encountered: