release req.Body when serving http

This commit is contained in:
Adrien Marquès 2018-10-02 17:14:44 +02:00
parent 37efb58b7b
commit 54d4b860de
1 changed files with 2 additions and 0 deletions

View File

@ -108,6 +108,8 @@ func New(_path string) (*Server, error) {
// ServeHTTP implements http.Handler and has to be called on each request // ServeHTTP implements http.Handler and has to be called on each request
func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) { func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
defer req.Body.Close()
/* (1) Build request */ /* (1) Build request */
apiRequest, err := apirequest.FromHTTP(req) apiRequest, err := apirequest.FromHTTP(req)
if err != nil { if err != nil {