Skip to content

Commit 3c6db6b

Browse files
committed
update response
1 parent 2822797 commit 3c6db6b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/luopengift/requests
33
go 1.12
44

55
require (
6+
github.com/davecgh/go-spew v1.1.1 // indirect
67
github.com/golang-io/pkg v0.0.0-20190424092429-486169a6c3e1
78
github.com/json-iterator/go v1.1.6 // indirect
89
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect

go.sum

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
21
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
34
github.com/golang-io/pkg v0.0.0-20190424092429-486169a6c3e1 h1:IIbIh1F/Rt98/cWBRiuBpt9NKHXXYFUuIzJtcVFmlP0=
45
github.com/golang-io/pkg v0.0.0-20190424092429-486169a6c3e1/go.mod h1:ExL8XxxRpVHx5kKfsiJhlJfd15NcdlRlGUq301ceQ9g=
56
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
67
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
8+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
79
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
10+
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
811
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
12+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
913
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1014
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
1115
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=

response.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ func newResponse() *Response {
2828
func (resp *Response) getBody() error {
2929
var err error
3030
resp.once.Do(func() {
31-
if resp == nil {
31+
if resp.Response == nil {
3232
return
3333
}
34-
defer resp.Body.Close()
35-
_, err = resp.body.ReadFrom(resp.Body)
34+
defer resp.Response.Body.Close()
35+
_, err = resp.body.ReadFrom(resp.Response.Body)
3636
})
3737
return err
3838
}

0 commit comments

Comments
 (0)