Skip to content

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.

4 participants