@@ -83,19 +83,26 @@ var DefaultClient = &Client{}
83
83
// goroutines.
84
84
type RoundTripper interface {
85
85
// RoundTrip executes a single HTTP transaction, returning
86
- // the Response for the request req. RoundTrip should not
87
- // attempt to interpret the response. In particular,
88
- // RoundTrip must return err == nil if it obtained a response,
89
- // regardless of the response's HTTP status code. A non-nil
90
- // err should be reserved for failure to obtain a response.
91
- // Similarly, RoundTrip should not attempt to handle
92
- // higher-level protocol details such as redirects,
86
+ // a Response for the provided Request.
87
+ //
88
+ // RoundTrip should not attempt to interpret the response. In
89
+ // particular, RoundTrip must return err == nil if it obtained
90
+ // a response, regardless of the response's HTTP status code.
91
+ // A non-nil err should be reserved for failure to obtain a
92
+ // response. Similarly, RoundTrip should not attempt to
93
+ // handle higher-level protocol details such as redirects,
93
94
// authentication, or cookies.
94
95
//
95
96
// RoundTrip should not modify the request, except for
96
- // consuming and closing the Body, including on errors. The
97
- // request's URL and Header fields are guaranteed to be
98
- // initialized.
97
+ // consuming and closing the Request's Body.
98
+ //
99
+ // RoundTrip must always close the body, including on errors,
100
+ // but depending on the implementation may do so in a separate
101
+ // goroutine even after RoundTrip returns. This means that
102
+ // callers wanting to reuse the body for subsequent requests
103
+ // must arrange to wait for the Close call before doing so.
104
+ //
105
+ // The Request's URL and Header fields must be initialized.
99
106
RoundTrip (* Request ) (* Response , error )
100
107
}
101
108
0 commit comments