Skip to content

Commit cbc8204

Browse files
authored
Merge pull request #452 from sudo-bmitch/pr-referrers-content-type
Specify content-type for referrers response
2 parents 60fc69c + b3f22a5 commit cbc8204

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

conformance/03_discovery_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ var test03ContentDiscovery = func() {
291291
resp, err := client.Do(req)
292292
Expect(err).To(BeNil())
293293
Expect(resp.StatusCode()).To(Equal(http.StatusOK))
294+
Expect(resp.Header().Get("Content-Type")).To(Equal("application/vnd.oci.image.index.v1+json"))
294295

295296
var index index
296297
err = json.Unmarshal(resp.Body(), &index)
@@ -305,6 +306,7 @@ var test03ContentDiscovery = func() {
305306
resp, err := client.Do(req)
306307
Expect(err).To(BeNil())
307308
Expect(resp.StatusCode()).To(Equal(http.StatusOK))
309+
Expect(resp.Header().Get("Content-Type")).To(Equal("application/vnd.oci.image.index.v1+json"))
308310
if h := resp.Header().Get("Docker-Content-Digest"); h != "" {
309311
Expect(h).To(Equal(configs[4].Digest))
310312
}
@@ -324,6 +326,7 @@ var test03ContentDiscovery = func() {
324326
resp, err := client.Do(req)
325327
Expect(err).To(BeNil())
326328
Expect(resp.StatusCode()).To(Equal(http.StatusOK))
329+
Expect(resp.Header().Get("Content-Type")).To(Equal("application/vnd.oci.image.index.v1+json"))
327330
if h := resp.Header().Get("Docker-Content-Digest"); h != "" {
328331
Expect(h).To(Equal(configs[4].Digest))
329332
}

spec.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ If the registry supports the referrers API, the registry MUST NOT return a `404
555555
If the request is invalid, such as a `<digest>` with an invalid syntax, a `400 Bad Request` MUST be returned.
556556

557557
Upon success, the response MUST be a JSON body with an image index containing a list of descriptors.
558+
The `Content-Type` header MUST be set to `application/vnd.oci.image.index.v1+json`.
558559
Each descriptor is of an image manifest in the same `<name>` namespace with a `subject` field that specifies the value of `<digest>`.
559560
The descriptors MUST include an `artifactType` field that is set to the value of the `artifactType` in the image manifest, if present.
560561
If the `artifactType` is empty or missing in the image manifest, the value of `artifactType` MUST be set to the config descriptor `mediaType` value.

0 commit comments

Comments
 (0)