Skip to content

proposal: net/http: clarify behavior of ResponseWriter's Write method #58518

Closed as not planned
@pkositsyn

Description

@pkositsyn

The main question: is it guaranteed that Write method of http.ResponseWriter either returns non-nil error or writes all the data?

If not, then it should be encouraged to use io.Copy(rw, bytes.NewReader(...)). Somehow I'm sure, that a lot of code already relies on full writes and my proposed construction isn't elegant for such boilerplate code

If yes, I would propose to add the guarantee to the comment for Write method

I believe that the guarantee should be provided, because the alternative is unobvious and adds unnecessary boilerplate, opposed to the maintenance of the property

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions