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

allow APIs to declare additional content-types #125

Merged
merged 3 commits into from
Jan 22, 2012

Conversation

joeyAghion
Copy link
Contributor

Let's support content-types beyond the built-in XML, JSON, Atom, RSS, and text.

class Twitter::API < Grape::API
  content_types :xls => "application/vnd.ms-excel"
end

@dblock
Copy link
Member

dblock commented Jan 20, 2012

Should this allow you to overwrite content-types altogether? This could be achieved by adding a content_type method that adds and a content_types method (this one) that overwrites.

@joeyAghion
Copy link
Contributor Author

I like the notion of refashioning this to content_type (rather than the plural)... makes it more clear that it's additive. See latest commit; updated interface is:

class Twitter::API < Grape::API
  content_type :xls, 'application/vnd.ms-excel'
end

And I understand the content_types idea, but I don't personally need it and it's a break from the handling of other format settings (which are typically merged together), so I suggest leaving that until it's useful for someone.

@dblock
Copy link
Member

dblock commented Jan 22, 2012

Nice and clean. Merging.

dblock added a commit that referenced this pull request Jan 22, 2012
allow APIs to declare additional content-types
@dblock dblock merged commit 6d8793f into ruby-grape:frontier Jan 22, 2012
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.

2 participants