1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:14:47 -07:00

simplify unexpected proxy status error

This commit is contained in:
Daniel 2021-11-29 11:56:31 -08:00
parent 230cc9f01c
commit 686f0da7a0
No known key found for this signature in database
GPG Key ID: AFFC4619A9B4AA95

View File

@ -1715,12 +1715,8 @@ func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *pers
return nil, err
}
if resp.StatusCode != 200 {
_, text, ok := strings.Cut(resp.Status, " ")
conn.Close()
if !ok {
return nil, errors.New("http: unknown status code (proxy)")
}
return nil, errors.New("http: " + text + " (proxy)")
return nil, fmt.Errorf("http: proxy returned unexpected status %q", resp.Status)
}
}