Skip to content

Commit

Permalink
update response
Browse files Browse the repository at this point in the history
  • Loading branch information
luopengift committed May 13, 2019
1 parent 2822797 commit 3c6db6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/luopengift/requests
go 1.12

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang-io/pkg v0.0.0-20190424092429-486169a6c3e1
github.com/json-iterator/go v1.1.6 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand Down
6 changes: 5 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-io/pkg v0.0.0-20190424092429-486169a6c3e1 h1:IIbIh1F/Rt98/cWBRiuBpt9NKHXXYFUuIzJtcVFmlP0=
github.com/golang-io/pkg v0.0.0-20190424092429-486169a6c3e1/go.mod h1:ExL8XxxRpVHx5kKfsiJhlJfd15NcdlRlGUq301ceQ9g=
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
Expand Down
6 changes: 3 additions & 3 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func newResponse() *Response {
func (resp *Response) getBody() error {
var err error
resp.once.Do(func() {
if resp == nil {
if resp.Response == nil {
return
}
defer resp.Body.Close()
_, err = resp.body.ReadFrom(resp.Body)
defer resp.Response.Body.Close()
_, err = resp.body.ReadFrom(resp.Response.Body)
})
return err
}
Expand Down

0 comments on commit 3c6db6b

Please sign in to comment.