Skip to content

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Jan 14, 2019

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.

Signed-off-by: Luca Bruno lucab@debian.org

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>
@codecov
Copy link

codecov bot commented Jan 14, 2019

Codecov Report

Merging #2813 into master will not change coverage.
The diff coverage is 80%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2813   +/-   ##
=======================================
  Coverage   60.25%   60.25%           
=======================================
  Files         103      103           
  Lines        8024     8024           
=======================================
  Hits         4835     4835           
  Misses       2546     2546           
  Partials      643      643
Flag Coverage Δ
#linux 60.25% <80%> (ø) ⬆️
Impacted Files Coverage Δ
registry/api/v2/descriptors.go 100% <ø> (ø) ⬆️
registry/api/errcode/handler.go 0% <0%> (ø) ⬆️
registry/handlers/app.go 48.34% <100%> (ø) ⬆️
registry/handlers/tags.go 73.07% <100%> (ø) ⬆️
registry/handlers/catalog.go 71.11% <100%> (ø) ⬆️
health/health.go 47.05% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91b0f05...15b0204. Read the comment docs.

@lucab
Copy link
Contributor Author

lucab commented Jan 14, 2019

@dmcgowan @caervs can you please have a quick look? This is a minor bugfix that primarily adjusts specs and code to avoid any ambiguities on unexpected charset (not allowed by standards). As a note, most of the registry code is already handling the proper JSON media-type, only a few endpoints (and related examples) are off.

@lucab
Copy link
Contributor Author

lucab commented Jan 14, 2019

Corresponding OCI distribution-spec change is up at opencontainers/distribution-spec#41.

Copy link
Contributor

@caervs caervs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but let's hold off on merging until we resolve the discussion in opencontainers/distribution-spec#41

Thanks @lucab!

@lucab
Copy link
Contributor Author

lucab commented Feb 7, 2019

Bump, the OCI distribution-spec counterpart of this got merged today.

@caervs caervs merged commit c192a28 into distribution:master Mar 1, 2019
@lucab lucab deleted the ups/spec-json-binary branch March 29, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants