close request bodies

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2020-11-04 10:28:54 +01:00
parent fbe3470ef3
commit 76c63ef696
3 changed files with 10 additions and 0 deletions
+3
View File
@@ -196,6 +196,9 @@ func (k Konnectd) Index() http.HandlerFunc {
if err != nil {
k.logger.Fatal().Err(err).Msg("Could not read index template")
}
if err = f.Close(); err != nil {
k.logger.Fatal().Err(err).Msg("Could not close body")
}
// TODO add environment variable to make the path prefix configurable
pp := "/signin/v1"
+4
View File
@@ -137,6 +137,10 @@ func (o Ocs) RemoveFromGroup(w http.ResponseWriter, r *http.Request) {
render.Render(w, r, response.ErrRender(data.MetaBadRequest.StatusCode, err.Error()))
return
}
if err = r.Body.Close(); err != nil {
render.Render(w, r, response.ErrRender(data.MetaServerError.StatusCode, err.Error()))
return
}
values, err := url.ParseQuery(string(body))
if err != nil {
@@ -145,6 +145,9 @@ func TestProxyIntegration(t *testing.T) {
if err != nil {
t.Fatal("Error reading result body")
}
if err = rr.Result().Body.Close(); err != nil {
t.Fatal("Error closing result body")
}
bodyString := string(resultBody)
if bodyString != `OK` {