Explorar el Código

Check for context error that is wrapped in url.Error

Signed-off-by: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
(cherry picked from commit 8ccb46a521964ab80490318504d6e02ae766a912)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Evgeniy Makhrov hace 5 años
padre
commit
89da709cb7
Se han modificado 1 ficheros con 1 adiciones y 2 borrados
  1. 1 2
      client/request.go

+ 1 - 2
client/request.go

@@ -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
 		}