registry: fix binary JSON content-type

This fixes registry endpoints to return the proper `application/json`
content-type for JSON content, also updating spec examples for that.

As per IETF specification and IANA registry [0], the `application/json`
type is a binary media, so the content-type label does not need any
text-charset selector. Additionally, the media type definition
explicitly states that it has no required nor optional parameters,
which makes the current registry headers non-compliant.

[0]: https://www.iana.org/assignments/media-types/application/json

Signed-off-by: Luca Bruno <lucab@debian.org>
This commit is contained in:
Luca Bruno
2019-01-14 08:53:03 +00:00
committed by Luca Bruno
parent 91b0f0559e
commit 15b0204758
12 changed files with 135 additions and 135 deletions

View File

@@ -80,7 +80,7 @@ func addTestFetch(repo string, dgst digest.Digest, content []byte, m *testutil.R
func addTestCatalog(route string, content []byte, link string, m *testutil.RequestResponseMap) {
headers := map[string][]string{
"Content-Length": {strconv.Itoa(len(content))},
"Content-Type": {"application/json; charset=utf-8"},
"Content-Type": {"application/json"},
}
if link != "" {
headers["Link"] = append(headers["Link"], link)
@@ -1062,7 +1062,7 @@ func TestObtainsErrorForMissingTag(t *testing.T) {
StatusCode: http.StatusNotFound,
Body: errBytes,
Headers: http.Header(map[string][]string{
"Content-Type": {"application/json; charset=utf-8"},
"Content-Type": {"application/json"},
}),
},
})