def test_decode_body_json_no_charset(self): body = b'{"test-string":"hello","test-bool":true}' headers = {"content-type": "application/json"} decoded_body = sansio.decode_body(headers, body) assert decoded_body == {"test-string": "hello", "test-bool": True}
def test_decode_body_string_ok(self): body = b"ok" decoded_body = sansio.decode_body({}, body) assert decoded_body == {"ok": True}
def test_decode_body_string_nok(self): body = b"hello world" decoded_body = sansio.decode_body({}, body) assert decoded_body == {"ok": False, "data": "hello world"}
def test_decode_body(self): body = b"hello world" decoded_body = sansio.decode_body({}, body) assert decoded_body == "hello world"