Files
responder/tests/test_encodings.py
T
kennethreitz e7776eb9e8 v3.0.0: Modernize for latest Starlette, drop EOL Pythons
- 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>
2026-03-22 05:51:47 -04:00

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