Skip to content

net/http: document when (RoundTripper).RoundTrip may return a nil *Response #37599

@bcmills

Description

@bcmills

(Factored out from #37598.)

The net/http.RoundTripper interface is currently ambiguous about what happens in case of errors.

Its documentation says:

    // RoundTrip executes a single HTTP transaction, returning
    // a Response for the provided Request.

but:

    // … RoundTrip must return err == nil if it obtained
    // a response, regardless of the response's HTTP status code.
    // A non-nil err should be reserved for failure to obtain a
    // response.

Unfortunately, it does not specify whether “failure to obtain a response” may correspond to a nil *Response, or only one that is only partially populated.

CC @bradfitz @rsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions