Exemple #1
0
def test_no_parse_json_content_with_bad_content_type():
    request = Request()
    request.body = b'{"test": "test value"}'
    request.method = "POST"
    request.headers = {"Content-Type": "text/plain"}
    response = json_app3(request)
    assert response.body == b'{"test": "test value"}'
Exemple #2
0
def test_parse_json_content():
    request = Request()
    request.body = b'{"test": "test value"}'
    request.method = "POST"
    request.headers = {"Content-Type": "application/json"}
    response = json_app1(request)
    assert response.body == "test value"
Exemple #3
0
def test_parse_json_content_with_charset():
    request = Request()
    request.body = b'{"test": "test value"}'
    request.method = "POST"
    request.headers = {"Content-Type": "application/json; charset=UTF-8"}
    response = json_app1(request)
    assert response.body == "test value"
Exemple #4
0
def test_no_parse_json_content_with_bad_content_type():
    request = Request()
    request.body = b'{"test": "test value"}'
    request.method = "POST"
    request.headers = {"Content-Type": "text/plain"}
    response = json_app3(request)
    assert response.body == b'{"test": "test value"}'
Exemple #5
0
def test_preserve_raw_body():
    request = Request()
    request.body = b'{"test": "test value"}'
    request.method = "POST"
    request.headers = {"Content-Type": "application/json"}
    response = json_app7(request)
    assert response.body == b'{"test": "test value"}'