mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 06:46:14 +00:00
b3c7252197
## About - Add Ruff configuration to `pyproject.toml`, apply its formatter, and satisfy its linter. - Migrate pytest configuration to `pyproject.toml`.
22 lines
516 B
Python
22 lines
516 B
Python
def test_custom_encoding(api, session):
|
|
data = "hi alex!"
|
|
|
|
@api.route("/")
|
|
async def route(req, resp):
|
|
req.encoding = "ascii"
|
|
resp.text = await req.text
|
|
|
|
r = session.post(api.url_for(route), data=data)
|
|
assert r.text == data
|
|
|
|
|
|
def test_bytes_encoding(api, session):
|
|
data = b"hi lenny!"
|
|
|
|
@api.route("/")
|
|
async def route(req, resp):
|
|
resp.text = (await req.content).decode("utf-8")
|
|
|
|
r = session.post(api.url_for(route), data=data)
|
|
assert r.content == data
|