Skip to content

Close the request body with a middleware instead of within the handler function body #85

@tiagoalvesdulce

Description

@tiagoalvesdulce

As mentioned by Luke here: #84 (comment).

We already have the middleware defined here:

func closeBody(f http.HandlerFunc) http.HandlerFunc {

And are using it here:

func (d *DcrtimeStore) addRoute(method string, route string, handler http.HandlerFunc) {

As we add every route with the addRoute method. It should be already working so the calls to defer r.Body.Close inside handler functions are redundant and can be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions