Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Do(): url.Error value's Timeout is false if request canceled #33545

Open
ansd opened this issue Aug 8, 2019 · 1 comment

Comments

@ansd
Copy link

commented Aug 8, 2019

What did you do?

Run the following: https://play.golang.org/p/jjlki46yvxi

What did you expect to see?

According to the docs of func (*Client) Do, I expect that "The url.Error value's Timeout method will report true if request timed out or was canceled."

What did you see instead?

The url.Error value's Timeout method reports false if request was canceled.

Additional notes

In contrast, if you run https://play.golang.org/p/xdNeyWl3Zc7, as the docs correctly state, the url.Error value's Timeout method reports true if request timed out.

The doc change got introduced in 6df4c3a.

The same documentation

Any returned error will be of type *url.Error. The url.Error value's Timeout method will report true if request timed out or was canceled.

also exists for func (*Client) Get and func Get.
Maybe the documentation refers to canceling a request via func (*Transport) CancelRequest?
However, since CancelRequest is deprecated, I would delete the part or was canceled from the docs of func (*Client) Do.

System details

go version go1.12.7 darwin/amd64
GOARCH="amd64"
GOBIN="/Users/david/go/bin"
GOCACHE="/Users/david/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/david/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.7/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
GOROOT/bin/go version: go version go1.12.7 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.12.7
uname -v: Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G87
lldb --version: lldb-1001.0.13.3
  Swift-5.0
gdb --version: GNU gdb (GDB) 8.3
@andybons

This comment has been minimized.

Copy link
Member

commented Aug 12, 2019

@andybons andybons added this to the Unplanned milestone Aug 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.