diff --git a/CHANGES/3116.bugfix b/CHANGES/3116.bugfix new file mode 100644 index 00000000000..16b94e9f759 --- /dev/null +++ b/CHANGES/3116.bugfix @@ -0,0 +1 @@ +Fix server request objects comparison \ No newline at end of file diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py index a2ef46cfa73..6c1b7c43895 100644 --- a/aiohttp/web_request.py +++ b/aiohttp/web_request.py @@ -634,6 +634,9 @@ def __repr__(self): return "<{} {} {} >".format(self.__class__.__name__, self._method, ascii_encodable_path) + def __eq__(self, other): + return id(self) == id(other) + @asyncio.coroutine def _prepare_hook(self, response): return diff --git a/tests/test_web_request.py b/tests/test_web_request.py index 39181781420..27e83540f48 100644 --- a/tests/test_web_request.py +++ b/tests/test_web_request.py @@ -634,3 +634,10 @@ def test_remote_with_closed_transport(): req = make_mocked_request('GET', '/') req._protocol = None assert req.remote is None + + +def test_eq(): + req1 = make_mocked_request('GET', '/path/to?a=1&b=2') + req2 = make_mocked_request('GET', '/path/to?a=1&b=2') + assert req1 != req2 + assert req1 == req1