diff --git a/requirements.txt b/requirements.txt index 8364e0b8a..30320fb2b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ aioamqp==0.10.0 -aiobotocore==0.4.5 -aiohttp==2.2.5 +aiobotocore==0.5.1 +aiohttp==2.3.2 async-timeout==2.0.0 -botocore==1.7.5 +botocore==1.7.40 chardet==3.0.4 codecov==2.0.9 coverage==4.4.2 @@ -23,4 +23,4 @@ six==1.11.0 tzlocal==1.4 ujson==1.35 uvloop==0.8.1 -yarl==0.13.0 +yarl==0.14.2 diff --git a/setup.py b/setup.py index 564819eb0..eddeb0518 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,12 @@ import tomodachi.__version__ install_requires = [ - 'aioamqp>=0.10.0', + 'aioamqp>=0.10.0, <0.11.0', 'ujson>=1.35', - 'uvloop>=0.8.0', - 'aiobotocore>=0.3.1', + 'uvloop>=0.8.1', + 'aiobotocore>=0.5.1, <0.6.0', 'tzlocal>=1.4', - 'aiohttp<=2.2.5' + 'aiohttp==2.3.2, <2.4.0' ] PY_VER = sys.version_info diff --git a/tests/test_http_service.py b/tests/test_http_service.py index 8bcf3f981..a57795d78 100644 --- a/tests/test_http_service.py +++ b/tests/test_http_service.py @@ -281,15 +281,27 @@ async def _async(loop: Any) -> None: await client.get('http://127.0.0.1:{}/test'.format(port)) with open(log_path) as file: content = file.read() - assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 0' in content - assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 0' not in content + assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 -' in content + assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 -' not in content async with aiohttp.ClientSession(loop=loop) as client: await client.get('http://127.0.0.1:{}/404'.format(port)) with open(log_path) as file: content = file.read() - assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 0' in content - assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 0' in content + assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 -' in content + assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 -' in content + + async with aiohttp.ClientSession(loop=loop) as client: + await client.post('http://127.0.0.1:{}/zero-post'.format(port), data=b'') + with open(log_path) as file: + content = file.read() + assert '[http] [404] 127.0.0.1 - "POST /zero-post HTTP/1.1" 8 0' in content + + async with aiohttp.ClientSession(loop=loop) as client: + await client.post('http://127.0.0.1:{}/post'.format(port), data=b'RANDOMDATA') + with open(log_path) as file: + content = file.read() + assert '[http] [404] 127.0.0.1 - "POST /post HTTP/1.1" 8 10' in content with open(log_path) as file: content = file.read() diff --git a/tomodachi/transport/http.py b/tomodachi/transport/http.py index 68e4e80cc..5f0cad8f8 100644 --- a/tomodachi/transport/http.py +++ b/tomodachi/transport/http.py @@ -97,10 +97,11 @@ def __call__(self) -> RequestHandler: class DynamicResource(web_urldispatcher.DynamicResource): - def __init__(self, pattern: Any, formatter: str, *, name: Optional[str]=None) -> None: - super().__init__(re.compile('\\/'), '/', name=name) + def __init__(self, pattern: Any, *, name: Optional[str]=None) -> None: + self._routes = [] # type: List + self._name = name self._pattern = pattern - self._formatter = formatter + self._formatter = '' class UrlDispatcher(web_urldispatcher.UrlDispatcher): @@ -110,8 +111,7 @@ def add_pattern_route(self, method: str, pattern: str, handler: Callable, *, nam except re.error as exc: raise ValueError( "Bad pattern '{}': {}".format(pattern, exc)) from None - formatter = '' - resource = DynamicResource(compiled_pattern, formatter, name=name) + resource = DynamicResource(compiled_pattern, name=name) self.register_resource(resource) if method == 'GET': resource.add_route('HEAD', handler, expect_handler=expect_handler)