Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Prevent read from closed stream.
Browse files Browse the repository at this point in the history
`PageResultFrom` parses the response body as JSON, but the response returned
from `client.Post` is already parsed (and the response body has been closed).
  • Loading branch information
smashwilson committed Jun 24, 2015
1 parent dbee478 commit fe80dae
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rackspace/lb/v1/nodes/requests.go
Expand Up @@ -119,10 +119,12 @@ func Create(client *gophercloud.ServiceClient, loadBalancerID int, opts CreateOp
return res
}

pr, err := pagination.PageResultFrom(resp)
if err != nil {
res.Err = err
return res
pr := pagination.PageResult{
Result: gophercloud.Result{
Body: res.Body,
Header: resp.Header,
},
URL: *resp.Request.URL,
}

return CreateResult{pagination.SinglePageBase(pr)}
Expand Down

0 comments on commit fe80dae

Please sign in to comment.