🐛 Fix: aiohttp 请求时 data 和 file 不能同时存在 (#2088)

This commit is contained in:
Jigsaw
2023-06-11 06:59:05 +00:00
committed by GitHub
parent 6eef863b70
commit 324277091c
2 changed files with 10 additions and 5 deletions

View File

@ -177,11 +177,15 @@ async def test_http_driver(driver: Driver):
assert data["json"] == {"json": "test"}
request = Request(
"POST", "https://httpbin.org/post", files={"test": ("test.txt", b"test")}
"POST",
"https://httpbin.org/post",
data={"form": "test"},
files={"test": ("test.txt", b"test")},
)
response = await driver.request(request)
assert response.status_code == 200 and response.content
data = json.loads(response.content)
assert data["form"] == {"form": "test"}
assert data["files"] == {"test": "test"}
await asyncio.sleep(1)