Description
The Response class uses description as the parameter name for the HTTP response body:
Response(status_code=200, description='{"ok": true}', headers={...})
This is confusing because description reads like metadata or documentation, not the actual response payload. Every project using Robyn ends up writing a wrapper to avoid the cognitive overhead:
def _json_response(body: dict, status: int = 200) -> Response:
return Response(
status_code=status,
description=json.dumps(body), # "description" = body??
headers={"Content-Type": "application/json"},
)
Suggestion
Add body (or content) as an alias for description in the Response constructor, so both work:
# New (intuitive):
Response(status_code=200, body='{"ok": true}')
# Old (still works for backwards compat):
Response(status_code=200, description='{"ok": true}')
This is a non-breaking change — just an alias.
Environment
Description
The
Responseclass usesdescriptionas the parameter name for the HTTP response body:This is confusing because
descriptionreads like metadata or documentation, not the actual response payload. Every project using Robyn ends up writing a wrapper to avoid the cognitive overhead:Suggestion
Add
body(orcontent) as an alias fordescriptionin theResponseconstructor, so both work:This is a non-breaking change — just an alias.
Environment