mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client.doRequest: improve GoDoc to clarify behavior
Outline that any error returned is a connectivity error and a nil-error requires the response to be handled (including errors returned in the response). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -133,6 +133,12 @@ func (cli *Client) sendRequest(ctx context.Context, method, path string, query u
|
||||
}
|
||||
}
|
||||
|
||||
// doRequest sends an HTTP request and returns an HTTP response. It is a
|
||||
// wrapper around [http.Client.Do] with extra handling to decorate errors.
|
||||
//
|
||||
// Otherwise, it behaves identical to [http.Client.Do]; an error is returned
|
||||
// when failing to make a connection, On error, any Response can be ignored.
|
||||
// A non-2xx status code doesn't cause an error.
|
||||
func (cli *Client) doRequest(req *http.Request) (*http.Response, error) {
|
||||
resp, err := cli.client.Do(req)
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user