xtransport: properly forward the status code on error

This commit is contained in:
Frank Denis 2021-07-31 12:38:10 +02:00
parent d3b1976208
commit cedd4f3b54
1 changed files with 2 additions and 2 deletions

View File

@ -409,12 +409,12 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string,
xTransport.tlsCipherSuite = nil
xTransport.rebuildTransport()
}
return nil, 0, nil, 0, err
return nil, resp.StatusCode, nil, rtt, err
}
tls := resp.TLS
bin, err := ioutil.ReadAll(io.LimitReader(resp.Body, MaxHTTPBodyLength))
if err != nil {
return nil, resp.StatusCode, tls, 0, err
return nil, resp.StatusCode, tls, rtt, err
}
resp.Body.Close()
return bin, resp.StatusCode, tls, rtt, err