Пример #1
0
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
Пример #2
0
def test_content_type_params_set_ok_param_quoting():
    res = Response()
    res.content_type_params = {'a': ''}
    assert res.headers['Content-Type'] == 'text/html; a=""'
Пример #3
0
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'
Пример #4
0
def test_content_type_params_set_ok_param_quoting():
    res = Response()
    res.content_type_params = {"a": ""}
    assert res.headers["Content-Type"] == 'text/html; a=""'
Пример #5
0
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"
Пример #6
0
def test_content_type_params_set_ok_param_quoting():
    res = Response()
    res.content_type_params = {"a": ""}
    assert res.headers["Content-Type"] == 'text/html; a=""'
Пример #7
0
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"