def test_response_json_body(): r = Response(json_body={"a": 1}) assert r.body == b'{"a":1}', repr(r.body) assert r.content_type == "application/json" r = Response() r.json_body = {"b": 1} assert r.content_type == "text/html" del r.json_body assert r.body == b""
def test_response_json_body(): r = Response(json_body={'a': 1}) assert r.body == b'{"a":1}', repr(r.body) assert r.content_type == 'application/json' r = Response() r.json_body = {"b": 1} assert r.content_type == 'text/html' del r.json_body assert r.body == b''