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

invariant: body after request is processed must be binary #662

Merged
merged 1 commit into from
Apr 27, 2017

Conversation

rsrdesarrollo
Copy link

Body must be of type bytes after request is processed, even if there is no data.
If not, code will fail for example in here if the request does not have any parameters in the body but the content-type is application/x-www-form-urlencoded

@seemethere
Copy link
Member

I don't have a milestone to group this with but I will merge once I do.

@@ -173,8 +173,7 @@ def on_body(self, body):
self.request.body.append(body)

def on_message_complete(self):
if self.request.body:
self.request.body = b''.join(self.request.body)
self.request.body = b''.join(self.request.body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail if the request body is None. Does that ever happen?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No originally self.request.body instantiates itself as a list

@seemethere seemethere added this to the 0.5.3 milestone Apr 27, 2017
@seemethere seemethere merged commit 140062f into sanic-org:master Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants