aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-02-07 13:38:16 +0530
committerMatthew Heon <matthew.heon@pm.me>2022-02-10 13:58:12 -0500
commit7e37c608f7ac04ffbb6e11b5b774acfd7afb6d95 (patch)
tree49d617fa7696266b0df9df52fd46f12ba82dc175 /pkg
parent9aee36b768fbbf58dd8550380e6cb67e33af3a22 (diff)
downloadpodman-7e37c608f7ac04ffbb6e11b5b774acfd7afb6d95.tar.gz
podman-7e37c608f7ac04ffbb6e11b5b774acfd7afb6d95.tar.bz2
podman-7e37c608f7ac04ffbb6e11b5b774acfd7afb6d95.zip
compat: endpoint /build must set header content type as application/json in reponse
Lot of clients are expecting proper `Content-type: application/json` configured in response headers of `/build` compat api. Following commit fixes that. Fixes issues where code is setting header field after writing header which is wrong. We must set `content-type` before we write and flush http header. Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images_build.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index cc9667202..0ebf74f98 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -605,8 +605,8 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
}
// Send headers and prime client for stream to come
- w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
flush()
body := w.(io.Writer)