From 2c31f383990c7288d63bec13a5a421e09a9386f0 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 12 Feb 2021 23:02:58 +0300 Subject: Fix superfluous response.WriteHeader call in WaitContainerLibpod() When the query decoding fails at the beginning of WaitContainerLibpod(), the Error() sets the header but doesn't returns after that. This causes the execution flow to reach the WriteResponse() at the end of WaitContainerLibpod(), which attempts to set another header, thus causing the following error: http: superfluous response.WriteHeader call from github.com/containers/podman/pkg/api/handlers/utils.WriteResponse (handler.go:124) [NO TESTS NEEDED] Signed-off-by: Nikolay Edigaryev --- pkg/api/handlers/utils/containers.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg') diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go index ba202cad0..e79def6f3 100644 --- a/pkg/api/handlers/utils/containers.go +++ b/pkg/api/handlers/utils/containers.go @@ -105,6 +105,7 @@ func WaitContainerLibpod(w http.ResponseWriter, r *http.Request) { query := waitQueryLibpod{} if err := decoder.Decode(&query, r.URL.Query()); err != nil { Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) + return } if _, found := r.URL.Query()["interval"]; found { -- cgit v1.2.3-54-g00ecf