-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Makes HTTPResponse serializable #2143
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
Conversation
@flovilmart updated the pull request. |
1 similar comment
@flovilmart updated the pull request. |
@flovilmart updated the pull request. |
1 similar comment
@flovilmart updated the pull request. |
@flovilmart updated the pull request. |
Great job @flovilmart. |
@flovilmart updated the pull request. |
let getText = () => { | ||
if (!_text && this.buffer) { | ||
_text = this.buffer.toString('utf-8'); | ||
} else if (!_text && _data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent looks off here
Looks great, i had two nits about whitespace but other than that shipit! |
@flovilmart updated the pull request. |
1 similar comment
@flovilmart updated the pull request. |
Great job guys. Thank you for merging so quickly. |
Fixes #2033
response.body don't seem to be set in some cases, and was never specified in the node.js docs.
This change rely on the
body
parameter from the response callback.Also, the getters have been replaced by ES5 definedProperty calls to make them enumerable so they play nice with serializers.
This change also does a bit of type inference in order to properly handle all body types (string, buffer and JSON)