change: xtransport: Return http response status string as error, do name make own string

This gives much better possibilities to diagnose problems than error
message with only "informative" part being 500.
This commit is contained in:
Markus Linnala 2019-10-16 12:49:18 +03:00 committed by Frank Denis
parent 72681725b1
commit df03065eaf
1 changed files with 1 additions and 1 deletions

View File

@ -272,7 +272,7 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string,
if resp == nil {
err = errors.New("Webserver returned an error")
} else if resp.StatusCode < 200 || resp.StatusCode > 299 {
err = fmt.Errorf("Webserver returned code %d", resp.StatusCode)
err = errors.New(resp.Status)
}
} else {
(*xTransport.transport).CloseIdleConnections()