diff --git a/pkg/api/routes.go b/pkg/api/routes.go index f3803ea7..a16a5aae 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -267,7 +267,7 @@ func (rh *RouteHandler) CheckManifest(w http.ResponseWriter, r *http.Request) { return } - _, digest, _, err := is.GetImageManifest(name, reference) + _, digest, mediaType, err := is.GetImageManifest(name, reference) if err != nil { switch err { case errors.ErrRepoNotFound: @@ -287,6 +287,7 @@ func (rh *RouteHandler) CheckManifest(w http.ResponseWriter, r *http.Request) { w.Header().Set(DistContentDigestKey, digest) w.Header().Set("Content-Length", "0") + w.Header().Set("Content-Type", mediaType) w.WriteHeader(http.StatusOK) } diff --git a/pkg/compliance/v1_0_0/check.go b/pkg/compliance/v1_0_0/check.go index 17fe87a2..c87cfcc6 100644 --- a/pkg/compliance/v1_0_0/check.go +++ b/pkg/compliance/v1_0_0/check.go @@ -550,6 +550,7 @@ func CheckWorkflows(t *testing.T, config *compliance.Config) { resp, err = resty.R().Head(baseURL + "/v2/repo7/manifests/test:1.0") So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, 200) + So(resp.Header().Get("Content-Type"), ShouldNotBeEmpty) resp, err = resty.R().Get(baseURL + "/v2/repo7/manifests/test:1.0") So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, 200) @@ -558,6 +559,7 @@ func CheckWorkflows(t *testing.T, config *compliance.Config) { resp, err = resty.R().Head(baseURL + "/v2/repo7/manifests/" + digest.String()) So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, 200) + So(resp.Header().Get("Content-Type"), ShouldNotBeEmpty) resp, err = resty.R().Get(baseURL + "/v2/repo7/manifests/" + digest.String()) So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, 200)