aboutsummaryrefslogtreecommitdiff
path: root/test/apiv2/10-images.at
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-02-07 13:38:16 +0530
committerAditya R <arajan@redhat.com>2022-02-07 13:38:19 +0530
commit3b561a468232c18c63d98920ce2812721d853f29 (patch)
tree88d0ced5d610484b088c07cb4da23bd6b3569502 /test/apiv2/10-images.at
parentab4af502b3f60f891192356eddaa13092f785612 (diff)
downloadpodman-3b561a468232c18c63d98920ce2812721d853f29.tar.gz
podman-3b561a468232c18c63d98920ce2812721d853f29.tar.bz2
podman-3b561a468232c18c63d98920ce2812721d853f29.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 'test/apiv2/10-images.at')
-rw-r--r--test/apiv2/10-images.at5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at
index 673858a3c..9526183e3 100644
--- a/test/apiv2/10-images.at
+++ b/test/apiv2/10-images.at
@@ -190,6 +190,11 @@ t POST "libpod/build?dockerfile=containerfile" $CONTAINERFILE_TAR application/js
t POST "build?dockerfile=containerfile" $CONTAINERFILE_TAR application/json 200 \
.stream~"STEP 1/1: FROM $IMAGE"
+# Build api response header must contain Content-type: application/json
+t POST "build?dockerfile=containerfile" $CONTAINERFILE_TAR application/json 200
+response_headers=$(cat "$WORKDIR/curl.headers.out")
+like "$response_headers" ".*application/json.*" "header does not contains application/json"
+
# PR #12091: output from compat API must now include {"aux":{"ID":"sha..."}}
t POST "build?dockerfile=containerfile" $CONTAINERFILE_TAR 200 \
'.aux|select(has("ID")).ID~^sha256:[0-9a-f]\{64\}$'