Skip to content
Merged
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
13 changes: 13 additions & 0 deletions tests/test_permanent.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,16 @@ def test_server_cleared_for_each_test(httpserver: HTTPServer):
assert httpserver.ordered_handlers == []
assert httpserver.oneshot_handlers == []
assert httpserver.handlers == []


def test_response_handler_replaced(httpserver: HTTPServer):
# https://github.com/csernazs/pytest-httpserver/issues/229
handler = httpserver.expect_request("/foobar")
handler.respond_with_data("FOO")
response = requests.get(httpserver.url_for("/foobar"))
assert response.text == "FOO"
assert response.status_code == 200
handler.respond_with_json({"foo": "bar"})
response = requests.get(httpserver.url_for("/foobar"))
assert response.json() == {"foo": "bar"}
assert response.status_code == 200