Skip to content

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

Closed
@ansd

Description

@ansd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions