Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderer should be able to create a response with no body #709

Closed
mmerickel opened this issue Oct 27, 2012 · 0 comments
Closed

renderer should be able to create a response with no body #709

mmerickel opened this issue Oct 27, 2012 · 0 comments

Comments

@mmerickel
Copy link
Member

It's not currently possible for a renderer to return None and cause the http response to return with no body. This means a renderer cannot return a valid 204 response HTTPNoContent.

Possible solutions would be to fix https://github.com/Pylons/pyramid/blob/master/pyramid/renderers.py#L576 such that if result is None then delete content_length, content_type, and do not set body instead of the current behavior of turning it into an empty string. At the very least the empty string should be b'' instead of unicode, because if a charset is not set on the response a unicode string causes issues.

Or just allow a renderer to return its own response object, overriding request.response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants