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:
parent
230cc9f01c
commit
686f0da7a0
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user