diff --git a/pytest_httpserver/httpserver.py b/pytest_httpserver/httpserver.py index 2c24ba8..04581ee 100644 --- a/pytest_httpserver/httpserver.py +++ b/pytest_httpserver/httpserver.py @@ -821,9 +821,9 @@ def respond_nohandler(self, request: Request, extra_message: str = ""): As the result, there's an assertion added (which can be raised by :py:meth:`check_assertions`). """ - text = "No handler found for request {!r}.\n".format(request) + text = "No handler found for request {!r} with data {!r}.".format(request, request.data) self.add_assertion(text + extra_message) - return Response("No handler found for this request", self.no_handler_status_code) + return Response(text + extra_message, self.no_handler_status_code) @abc.abstractmethod def dispatch(self, request: Request) -> Response: diff --git a/tests/test_blocking_httpserver.py b/tests/test_blocking_httpserver.py index 7fbea11..88d0709 100644 --- a/tests/test_blocking_httpserver.py +++ b/tests/test_blocking_httpserver.py @@ -97,7 +97,10 @@ def test_ignores_when_request_is_not_asserted(httpserver: BlockingHTTPServer): ) with when_a_request_is_being_sent_to_the_server(request) as server_connection: - assert server_connection.get(timeout=9).text == "No handler found for this request" + assert ( + server_connection.get(timeout=9).text + == f"No handler found for request with data b''." + ) def test_raises_assertion_error_when_request_was_not_responded(httpserver: BlockingHTTPServer):