http.Response.Body of api response is sometimes not read completely and connections are not reused.
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
### `consul version` for both Client and Server
Client: `0.8.5`
Server: `0.8.5`
### Operating system and Environment details
Go 1.8.3
### Description of the Issue (and unexpected/desired result)
The consul api client in golang does not consume the complete body of the response received from the consul server. Because of that, the http (keep alive) connection can not be re-used and will be closed.
### Reproduction steps
Use a connection that prints a message, each time a new connection is created, then call some endpoints, like `client.Health().Service("my-service", "", true, nil)`:
```golang
api.NewClient(&api.Config{
Address: consulAddress,
HttpClient: &http.Client{
Transport: &http.Transport{
Proxy: nil,
DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
log.Infof("Dialing %s %s", network, address)
return dial(ctx, network, address)
},
ResponseHeaderTimeout: 90 * time.Second,
},
},
})
```
Contributor guide
Assessment
This issue has not been assessed yet.