Open tiagoalvesdulce opened 1 year ago
As mentioned by Luke here: https://github.com/decred/dcrtime/pull/84#discussion_r1021757335.
We already have the middleware defined here: https://github.com/decred/dcrtime/blob/bbebe6df45a8c650c4e605d778494480b056f121/dcrtimed/dcrtimed.go#L1297
And are using it here: https://github.com/decred/dcrtime/blob/bbebe6df45a8c650c4e605d778494480b056f121/dcrtimed/dcrtimed.go#L1306
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.
addRoute
defer r.Body.Close
As mentioned by Luke here: https://github.com/decred/dcrtime/pull/84#discussion_r1021757335.
We already have the middleware defined here: https://github.com/decred/dcrtime/blob/bbebe6df45a8c650c4e605d778494480b056f121/dcrtimed/dcrtimed.go#L1297
And are using it here: https://github.com/decred/dcrtime/blob/bbebe6df45a8c650c4e605d778494480b056f121/dcrtimed/dcrtimed.go#L1306
As we add every route with the
addRoute
method. It should be already working so the calls todefer r.Body.Close
inside handler functions are redundant and can be removed.