Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for RFC6839 #1839

Open
ghermeto opened this issue Jul 2, 2020 · 0 comments
Open

Support for RFC6839 #1839

ghermeto opened this issue Jul 2, 2020 · 0 comments

Comments

@ghermeto
Copy link
Member

ghermeto commented Jul 2, 2020

Additional media types (+json)

What?

Support RFC6839 allowing formatters for additional media types structured with syntax suffixes, like +json.

Valid examples are: application/calendar+json, application/problem+json, application/geo+json, etc (the full list can be seen on mime-db)...

Why?

Right now if you try to follow RFC7807 and send back a Content-Type application/problem+json, it won't find the correct formatter (which is json) and will override the content-type to application/octet-stream.

Example API

server.get('/', function (req, res, next) {
  res.contentType = 'problem+json';
  res.send({
    "type": "https://example.com/probs/out-of-credit",
    "title": "You do not have enough credit.",
    "detail": "Your current balance is 30, but that costs 50." 
  });
});

Are you willing and able to implement this?

I'm converting PR #1786 from RFC7807 to RFC6839 and we can tackle RFC7807 on a separate issue.

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

No branches or pull requests

1 participant