Check for context error that is wrapped in url.Error

Signed-off-by: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
(cherry picked from commit 8ccb46a521)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Evgeniy Makhrov 2020-08-03 15:59:22 +03:00 committed by Sebastiaan van Stijn
parent 88820a4793
commit 89da709cb7
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -143,8 +143,7 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
// Don't decorate context sentinel errors; users may be comparing to
// them directly.
switch err {
case context.Canceled, context.DeadlineExceeded:
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
return serverResp, err
}