def test_utf8_post_json():
app = Sanic('test_utf8_post_json')
@app.route('/')
async def handler(request):
return text('OK')
payload = {'test': '?'}
headers = {'content-type': 'application/json'}
request, response = app.test_client.get(
'/',
data=json_dumps(payload), headers=headers)
assert request.json.get('test') == '?'
assert response.text == 'OK'
评论列表
文章目录