Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pook/interceptors/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def __call__(
req = Request(
method=request.method,
headers=request.headers.items(),
body=request.body,
body=request.body.decode(),
url=str(request.url),
)

Expand Down
15 changes: 15 additions & 0 deletions tests/integration/pook_aiohttp_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest
import aiohttp

import pook

pytestmark = [pytest.mark.pook]


async def test_aiohttp_match_body():
body = {"foo": "bar"}
pook.post("http://example.com", body="foo=1").reply(200).json(body)
res = await aiohttp.ClientSession().post("http://example.com", data={"foo": 1})
assert res.status == 200
assert res.headers == {"Content-Type": "application/json"}
assert await res.json() == body