소스 검색

Check for context error that is wrapped in url.Error

Signed-off-by: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
Evgeniy Makhrov 5 년 전
부모
커밋
8ccb46a521
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      client/request.go

+ 1 - 2
client/request.go

@@ -134,8 +134,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
 		}