Skip to content

net/http: documentation of "func (*Client) Do" doesn't state clearly when to close response.Body #8633

@gopherbot

Description

@gopherbot

by fish@freigeist.org:

The documentation for Do()[1] says:

"When err is nil, resp always contains a non-nil resp.Body."

But it doesn't specify the behaviour if error is non-nil:
Do I need to close the Body if err is NOT nil?






---
[1] https://godoc.org/net/http#Client.Do

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions