From f3a6a7568eb4b99c6d1769db36341e3f6d4edd5c Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 27 Oct 2021 16:01:43 -0400 Subject: [PATCH] spec: clarify handling regarding Content-type header Signed-off-by: Vincent Batts --- spec.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec.md b/spec.md index 7161b860..3a96ee42 100644 --- a/spec.md +++ b/spec.md @@ -146,7 +146,9 @@ Throughout this document, `` as a tag MUST be at most 128 characters The client SHOULD include an `Accept` header indicating which manifest content types it supports. In a successful response, the `Content-Type` header will indicate the type of the returned manifest. -For more information on the use of `Accept` headers and content negotiation, please see [Content Negotiation](./content-negotiation.md) +The `Content-Type` header SHOULD match what the client [pushed as the manifest's `Content-Type`](#pushing-manifests). +If the manifest has a `mediaType` field, clients SHOULD reject unless the `mediaType` field's value matches the type specified by the `Content-Type` header. +For more information on the use of `Accept` headers and content negotiation, please see [Content Negotiation](./content-negotiation.md). A GET request to an existing manifest URL MUST provide the expected manifest, with a response code that MUST be `200 OK`. A successful response SHOULD contain the digest of the uploaded blob in the header `Docker-Content-Digest`. @@ -386,11 +388,20 @@ it SHOULD return a `202`. This indicates that the upload session has begun and t To push a manifest, perform a `PUT` request to a path in the following format, and with the following headers and body: `/v2//manifests/` [end-7](#endpoints) + +Clients SHOULD set the `Content-Type` header to the type of the manifest being pushed. +All manifests SHOULD include a `mediaType` field declaring the type of the manifest being pushed. +If a manifest includes a `mediaType` field, clients MUST set the `Content-Type` header to the value specified by the `mediaType` field. + ``` Content-Type: application/vnd.oci.image.manifest.v1+json ``` +Manifest byte stream: ``` - +{ + "mediaType": "application/vnd.oci.image.manifest.v1+json", + ... +} ``` `` is the namespace of the repository, and the `` MUST be either a) a digest or b) a tag.