mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
routes: add Content-Type header for HEAD manifest response
With recent docker client-side changes, on 'docker pull' we see: "Error response from daemon: missing or empty Content-Type header" Hence, set Content-Type header. Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
b686a48812
commit
f10c174c0e
+2
-1
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user