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

Respect content-type from provides route annotations #50

Merged
merged 1 commit into from Oct 10, 2018

Conversation

slobo
Copy link
Contributor

@slobo slobo commented Oct 10, 2018

Formatter middleware now respects provides annotation for routes and
uses it both as default and as a restriction on allowed response
content types.

This makes it possible to for ex. output binary blobs on specific paths,
while keeping the rest of the paths as structured data.

To acheive this, we needed to make the following changes:

  • Raisin::Middleware::Formatter is now aware of the running Raisin app
    (via raisin attribute)

  • ::Formatter->negotiate_format method has gained a new parmeter to
    allow for picking the proper default when provides is configured and
    Accept: */* header is sent

Formatter middleware now respects `provides` annotation for routes and
uses it both as default and as a restriction  on allowed response
content types.

This makes it possible to for ex. output binary blobs on specific paths,
while keeping the rest of the paths as structured data.

To acheive this, we needed to make the following changes:

* `Raisin::Middleware::Formatter` is now aware of the running Raisin app
(via `raisin` attribute)

* `::Formatter->negotiate_format` method has gained a new parmeter to
allow for picking the proper default when `provides` is configured and
`Accept: */*` header is sent
@khrt khrt merged commit 81ef194 into khrt:master Oct 10, 2018
@khrt
Copy link
Owner

khrt commented Oct 10, 2018

Thanks for the merge request!

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.

None yet

2 participants