tun2: connection: do things better

This commit is contained in:
Cadey Ratio 2017-10-03 06:31:05 -07:00
parent 223b816f88
commit 64524eefc1
No known key found for this signature in database
GPG Key ID: D607EE27C2E7F89A
1 changed files with 0 additions and 9 deletions

View File

@ -4,7 +4,6 @@ import (
"bufio"
"context"
"io"
"io/ioutil"
"net"
"net/http"
"time"
@ -139,20 +138,12 @@ func (c *Connection) RoundTrip(req *http.Request) (*http.Response, error) {
if err != nil {
return nil, errors.Wrap(err, ErrCantReadResponse.Error())
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, errors.Wrap(err, "can't read response body")
}
resp.Body = &mixedReadCloser{
Reader: buf,
Closer: stream,
}
resp.ContentLength = int64(len(body))
return resp, nil
}