Skip to content

Commit e120a29

Browse files
committed
Restore aiohttp interceptor delay support
In h2non#170, network delay simulation was accidentally dropped from the aiohttp interceptor.
1 parent c7dcf2d commit e120a29

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/pook/interceptors/aiohttp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
from http.client import responses as http_reasons
23
from typing import Optional
34
from unittest import mock
@@ -38,6 +39,9 @@ async def __call__(
3839
if not mock:
3940
return await handler(request)
4041

42+
if mock._delay:
43+
await asyncio.sleep(mock._delay / 1000)
44+
4145
# Shortcut to mock response
4246
res = mock._response
4347

0 commit comments

Comments
 (0)