From 3c6883ccbc6a59569222e8295784200b4e662d3e Mon Sep 17 00:00:00 2001 From: Simon Kotwicz Date: Sun, 20 Feb 2022 08:24:08 +0000 Subject: [PATCH] net/http: add doc details regarding Transport retries Add doc details to Transport mentioning retries only occur if a connection has been already been used successfully. Change-Id: I37afbad50b885248e0e6cd5e799ad848bf97c86b GitHub-Last-Rev: 7c45c32aec2bd3266c525bf28ab1879acbecf193 GitHub-Pull-Request: golang/go#51273 Reviewed-on: https://go-review.googlesource.com/c/go/+/386994 Run-TryBot: Damien Neil Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Damien Neil Auto-Submit: Dmitri Shuralyov --- src/net/http/transport.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/net/http/transport.go b/src/net/http/transport.go index 8de63cdb88..3ed5068eef 100644 --- a/src/net/http/transport.go +++ b/src/net/http/transport.go @@ -85,13 +85,13 @@ const DefaultMaxIdleConnsPerHost = 2 // ClientTrace.Got1xxResponse. // // Transport only retries a request upon encountering a network error -// if the request is idempotent and either has no body or has its -// Request.GetBody defined. HTTP requests are considered idempotent if -// they have HTTP methods GET, HEAD, OPTIONS, or TRACE; or if their -// Header map contains an "Idempotency-Key" or "X-Idempotency-Key" -// entry. If the idempotency key value is a zero-length slice, the -// request is treated as idempotent but the header is not sent on the -// wire. +// if the connection has been already been used successfully and if the +// request is idempotent and either has no body or has its Request.GetBody +// defined. HTTP requests are considered idempotent if they have HTTP methods +// GET, HEAD, OPTIONS, or TRACE; or if their Header map contains an +// "Idempotency-Key" or "X-Idempotency-Key" entry. If the idempotency key +// value is a zero-length slice, the request is treated as idempotent but the +// header is not sent on the wire. type Transport struct { idleMu sync.Mutex closeIdle bool // user has requested to close all idle conns -- 2.48.1