Skip to content

Commit

Permalink
Fix superfluous response.WriteHeader call in WaitContainerLibpod()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
edigaryev committed Feb 12, 2021
1 parent 1d15ed7 commit 2c31f38
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/handlers/utils/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2c31f38

Please sign in to comment.