Skip to content

Instantly share code, notes, and snippets.

Last active Jan 13, 2019
What would you like to do?
example server and client to reproduce a Reason-Phrase bug in Python’s aiohttp library (
import asyncio
from urllib.parse import urljoin
from aiohttp.client import request
async def main():
for endpoint in ["/success_without_reason", "/failure_without_reason"]:
async with request("get", urljoin("",
endpoint)) as resp:
print(f"{endpoint} passes ok")
from aiohttp import web
async def success_without_reason(request):
return web.Response(body="everything is ok", status=200, reason="")
async def failure_without_reason(request):
return web.Response(body="my tummy feels funny", status=500, reason="")
def init():
app = web.Application()
app.router.add_get("/success_without_reason", success_without_reason)
app.router.add_get("/failure_without_reason", failure_without_reason)
return app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment