Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/http2/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ var (
// It returns either a request to retry (either the same request, or a
// modified clone), or an error if the request can't be replayed.
func shouldRetryRequest(req *http.Request, err error) (*http.Request, error) {
if !canRetryError(err) {
if !CanRetryError(err) {
return nil, err
}
// If the Body is nil (or http.NoBody), it's safe to reuse
Expand Down Expand Up @@ -558,7 +558,7 @@ func shouldRetryRequest(req *http.Request, err error) (*http.Request, error) {
return nil, fmt.Errorf("http2: Transport: cannot retry err [%v] after Request.Body was written; define Request.GetBody to avoid this error", err)
}

func canRetryError(err error) bool {
func CanRetryError(err error) bool {
if err == errClientConnUnusable || err == errClientConnGotGoAway {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ func (t *Transport) roundTrip(req *http.Request) (resp *http.Response, err error

if scheme == "https" && t.forceHttpVersion != h1 {
resp, err := t.t2.RoundTripOnlyCachedConn(req)
if err != h2internal.ErrNoCachedConn {
if err != h2internal.ErrNoCachedConn && !h2internal.CanRetryError(err) {
return resp, err
}
req, err = rewindBody(req)
Expand Down