openfaas / golang-http-template

Golang templates for OpenFaaS using HTTP extensions
https://www.openfaas.com/
MIT License
106 stars 57 forks source link

golang-middleware: Body not closed #8

Closed alexellis closed 6 years ago

alexellis commented 6 years ago

In the default handler for golang-middleware the body is not closed of the request. This is generally done when reading the body.

I'd expect to see something like:

defer r.Body.Close()
alexellis commented 6 years ago

cc @stefanprodan

alexellis commented 6 years ago

https://github.com/openfaas-incubator/golang-http-template/blob/master/template/golang-middleware-armhf/main.go#L16

https://github.com/openfaas-incubator/golang-http-template/blob/master/template/golang-middleware/main.go#L16

0sc commented 6 years ago

Can I work on this?

alexellis commented 6 years ago

Sure, are you confident you can do the testing too?

Alex

0sc commented 6 years ago

I can try. What should the testing look like?

alexellis commented 6 years ago

Building a function with the template, deploying it and invoking it.

0sc commented 6 years ago

I was thinking since the issue is about fixing the not closed request body, testing with default http requests might suffice.

alexellis commented 6 years ago

Derek close: fixed by @rdimitrov

alexellis commented 6 years ago

@0sc there's a couple of more small issues on this repo if you're interested.