close http request body

This commit is contained in:
Chris Lu 2020-11-30 02:45:00 -08:00
parent 0e99531dbf
commit 141ce67c09
2 changed files with 6 additions and 0 deletions

View file

@ -66,6 +66,7 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
) )
fs.autoChunk(ctx, w, r, so) fs.autoChunk(ctx, w, r, so)
util.CloseRequest(r)
} }

View file

@ -374,3 +374,8 @@ func CloseResponse(resp *http.Response) {
io.Copy(ioutil.Discard, resp.Body) io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close() resp.Body.Close()
} }
func CloseRequest(req *http.Request) {
io.Copy(ioutil.Discard, req.Body)
req.Body.Close()
}