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

Save response body when parsing JSON #44

Closed
wants to merge 1 commit into from
Closed

Save response body when parsing JSON #44

wants to merge 1 commit into from

Conversation

jbcjorge
Copy link

@jbcjorge jbcjorge commented Jan 2, 2018

As the json decoder consumes the reader and there are cases where we
want to preserve the response body to further process outside sling a
flag to restore it has been included

As the json decoder consumes the reader and there are cases where we
want to preserve the response body to further process outside sling a
flag to restore it has been included
@sungo
Copy link

sungo commented May 9, 2018

@dghubble any chance of getting this merged?

// Read the content
var bodyBytes []byte
if resp.Body != nil {
bodyBytes, _ = ioutil.ReadAll(resp.Body)
Copy link
Owner

Choose a reason for hiding this comment

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

should never be needed in a response handling library

@dghubble
Copy link
Owner

If the desire is to parse the response directly, its best to just parse the response directly. No need to shoehorn the "save response" case alongside the convenience JSON object decoders. If any additional features are added to sling, the decoder proposal has a better chance.

@dghubble dghubble closed this Jun 3, 2018
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