Skip to content

Conversation

@oogali
Copy link
Contributor

@oogali oogali commented Apr 27, 2020

PR to take an attempt at #71

To use json.NewDecoder, we need to use the I/O stream from the HTTP response object.

This is merely a starting point.

oogali added 2 commits April 26, 2020 22:51
In order to use json.NewDecoder, we have to operate on an I/O stream.

So, we swap out passing around a byteslice for this instead.

This means we can't defer closure of the body stream within the
`doRawRequest` method and have to unwrap it into individual close
statements.

But we can in the higher level `doRequest` method.

Finally, in `Repository.GetFileBlob`, we utilize `ioutil.ReadAll` to
replicate the original functionality to consume the response body.
Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

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

LGTM, exactly it is correct to use json.NewDecoder for http stream.

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.

2 participants