mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 06:46:14 +00:00
e7776eb9e8
- Bump version to 3.0.0 - Replace deprecated starlette.middleware.wsgi with a2wsgi - Pin starlette[full]>=0.40, add a2wsgi dependency - Bump minimum Python to 3.9, drop 3.7/3.8 support - Remove whitenoise conditional (Python <3.8 no longer supported) - Clean up CI matrix: drop old Python versions and OS exclusions - Fix deprecated httpx TestClient usage in tests (data= -> content=, per-request cookies) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
522 B
Python
22 lines
522 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), content=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), content=data)
|
|
assert r.content == data
|