fix: add body close call

This commit is contained in:
jar3b@outlook.com 2021-10-07 22:24:57 +03:00
parent 0b9114e50c
commit ca5a582074

View File

@ -12,6 +12,7 @@ func (r *Request) FromHTTP(req *http.Request) error {
return errors.New("nats_transport: request cannot be nil") return errors.New("nats_transport: request cannot be nil")
} }
defer req.Body.Close()
buf, err := ioutil.ReadAll(req.Body) buf, err := ioutil.ReadAll(req.Body)
if err != nil { if err != nil {
return fmt.Errorf("nats_transport: cannot read request body") return fmt.Errorf("nats_transport: cannot read request body")