Skip to content

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

Merged
merged 6 commits into from
Jun 25, 2016
Merged

Makes HTTPResponse serializable #2143

merged 6 commits into from
Jun 25, 2016

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Jun 24, 2016

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)

@ghost
Copy link

ghost commented Jun 24, 2016

@flovilmart updated the pull request.

1 similar comment
@ghost
Copy link

ghost commented Jun 24, 2016

@flovilmart updated the pull request.

@ghost
Copy link

ghost commented Jun 25, 2016

@flovilmart updated the pull request.

1 similar comment
@ghost
Copy link

ghost commented Jun 25, 2016

@flovilmart updated the pull request.

@ghost
Copy link

ghost commented Jun 25, 2016

@flovilmart updated the pull request.

@cleever
Copy link

cleever commented Jun 25, 2016

Great job @flovilmart.
Thank you for your attention!

@ghost
Copy link

ghost commented Jun 25, 2016

@flovilmart updated the pull request.

let getText = () => {
if (!_text && this.buffer) {
_text = this.buffer.toString('utf-8');
} else if (!_text && _data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

indent looks off here

@TylerBrock
Copy link
Contributor

Looks great, i had two nits about whitespace but other than that shipit! :shipit:

@flovilmart flovilmart changed the title Use the callback body instead of response.body that may not be set Makes HTTPResponse serializable Jun 25, 2016
@ghost
Copy link

ghost commented Jun 25, 2016

@flovilmart updated the pull request.

1 similar comment
@ghost
Copy link

ghost commented Jun 25, 2016

@flovilmart updated the pull request.

@TylerBrock TylerBrock merged commit 3e41368 into master Jun 25, 2016
@cleever
Copy link

cleever commented Jun 25, 2016

Great job guys. Thank you for merging so quickly.

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.

3 participants