Skip to content

Make it clear that the caller is responsible for closing the body #26

@pennersr

Description

@pennersr

I am using webpush-go over at https://gitlab.com/pennersr/shove -- thanks! One thing that I initially overlooked was the fact that SendNotification() returns an http.Response, for which the following holds:

If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request.

The README/example contains this (it ignores the response):

// Send Notification
_, err := webpush.SendNotification(

So the fact that the caller is responsible for handling the caveat mentioned above is not very obvious.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions