pkg/api: BufferedResponseWriter flush correctly

Somehow my error message in top was never printed for the compat API,
the libpod one using the same code worked fine. Turns out the compat one
is using this buffered writter instaed but never made sure to flush it
before closing the connection.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-06-23 16:51:22 +02:00
parent d0505d6bac
commit 0ee19f08cf

View File

@ -56,7 +56,9 @@ func (s *APIServer) apiWrapper(h http.HandlerFunc, w http.ResponseWriter, r *htt
}
if buffer {
w = newBufferedResponseWriter(w)
bw := newBufferedResponseWriter(w)
defer bw.b.Flush()
w = bw
}
h(w, r)