mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: if context is canceled, return its error
This permits the error message to distinguish between a context that was canceled and a context that timed out. Updates #16381. Change-Id: I3994b98e32952abcd7ddb5fee08fa1535999be6d Reviewed-on: https://go-review.googlesource.com/24978 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
643b9ec07c
commit
0b5f2f0d11
3 changed files with 57 additions and 33 deletions
|
|
@ -313,8 +313,8 @@ func TestClientRedirectContext(t *testing.T) {
|
|||
if !ok {
|
||||
t.Fatalf("got error %T; want *url.Error", err)
|
||||
}
|
||||
if ue.Err != ExportErrRequestCanceled && ue.Err != ExportErrRequestCanceledConn {
|
||||
t.Errorf("url.Error.Err = %v; want errRequestCanceled or errRequestCanceledConn", ue.Err)
|
||||
if ue.Err != context.Canceled {
|
||||
t.Errorf("url.Error.Err = %v; want %v", ue.Err, context.Canceled)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue