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

Add an accepts: option #1310

Closed
postmodern opened this issue Jun 14, 2013 · 4 comments
Closed

Add an accepts: option #1310

postmodern opened this issue Jun 14, 2013 · 4 comments

Comments

@postmodern
Copy link
Contributor

Add an accepts: option as a companion to provides:. This option would compare the media-type of a request to the list of MIME types. This is the Sinatra condition I am currently using:

set(:accepts) do |*types|
  mime_types = types.map { |t| mime_type(t) }.compact

  condition { mime_types.include?(request.media_type) }
end
@DAddYE
Copy link
Member

DAddYE commented Jul 1, 2013

@padrino/core-members any want to work on this, or @postmodern feel free to send us a pull request

@dariocravero
Copy link

I think we can look at implementing it for the new router. Thoughts?

@ujifgc ujifgc added router and removed enhancement labels Feb 17, 2014
namusyaka added a commit that referenced this issue Mar 17, 2014
ujifgc added a commit that referenced this issue Mar 19, 2014
@namusyaka
Copy link
Contributor

Closed this in #1628
Please let me know if that is not good enough.

@postmodern
Copy link
Contributor Author

Looks more robust than my little Sinatra condition. On a side note, has anyone tested how well Padrino is suited for Hyper Media APIs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants