def test_defaults_to_text_content_type(self): response = interaction_server_impl._Response(status_code=200, payload=b"hi there") assert response.headers == { "Content-Type": "text/plain; charset=UTF-8" } assert response.payload == b"hi there" assert response.status_code == 200
def test_when_content_type_provided(self): response = interaction_server_impl._Response( status_code=201, payload=b'{"ok": "no"}', content_type="application/json") assert response.headers == {"Content-Type": "application/json"} assert response.payload == b'{"ok": "no"}' assert response.status_code == 201
def test_when_only_status(self): response = interaction_server_impl._Response(status_code=204) assert response.payload is None assert response.headers is None assert response.status_code == 204