This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove CancelRequest implementation, tracking of request copies.
In older versions of Go and net/http standard library, implementations
of http.RoundTripper had to implement CancelRequest method in order to
enable request cancellation. That CancelRequest method has since been
deprecated in favor of more modern ways of request cancellation, which
is via Request.Cancel field and/or request context. Modern http.Client
uses Request.Cancel field to implement its Timeout field, but also calls
the deprecated CancelRequest method, if it's implemented, just in case.
Since this package is expected to run on modern versions of Go (it
requires Go 1.6+ at this time), we can safely remove the deprecated
CancelRequest method implementation.
The benefits of doing that include:
- Remove the unneeded "httpcache: Client Transport of type %T doesn't
support CancelRequest; Timeout not supported" warning from being
logged.
- Simplify and remove code for tracking the mapping between the
original and copied request, which was only needed by the
implementation of the CancelRequest method.
- onEOFReader also becomes unused, and can be removed.
Add a simple timeout test to verify that http.Client.Timeout value is
respected when a cache transport is used.
Skip this test in short mode, because it takes at least 3 seconds to
run, to test timeouts. This is significantly longer than other tests.
Resolves #61.
Updates #62.
- Loading branch information
Showing
2 changed files
with
33 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters