def test_set_charset_fails_when_json(): content_type = 'application/json' expected = content_type res = Response(content_type=content_type) res.charset = 'utf-8' assert res.headers['content-type'] == expected res.content_type_params = {'charset': 'utf-8'} assert res.headers['content-type'] == expected
def test_content_type_params_set_ok_param_quoting(): res = Response() res.content_type_params = {'a': ''} assert res.headers['Content-Type'] == 'text/html; a=""'
def test_content_type_params_set_value_dict_empty(): res = Response() res.headers['Content-Type'] = 'foo;bar' res.content_type_params = None assert res.headers['Content-Type'] == 'foo'
def test_content_type_params_set_ok_param_quoting(): res = Response() res.content_type_params = {"a": ""} assert res.headers["Content-Type"] == 'text/html; a=""'
def test_content_type_params_set_value_dict_empty(): res = Response() res.headers["Content-Type"] = "foo;bar" res.content_type_params = None assert res.headers["Content-Type"] == "foo"
def test_content_type_params_set_ok_param_quoting(): res = Response() res.content_type_params = {"a": ""} assert res.headers["Content-Type"] == 'text/html; a=""'
def test_content_type_params_set_value_dict_empty(): res = Response() res.headers["Content-Type"] = "foo;bar" res.content_type_params = None assert res.headers["Content-Type"] == "foo"