-
Notifications
You must be signed in to change notification settings - Fork 23
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 Additional Content Types #22
Comments
@edpaget i like this idea! the content_type + response handling has always felt a bit clunky to me, this would be a good opportunity to tidy that up. thank you! |
Great I'll keep working on it then. |
@edpaget thanks, let me know if you have further questions; otherwise, i humbly await a PR. |
@edpaget getting close to a 0.4 release, tons of changes; wanted to check in on this status. |
Hi @kenichi, I'm very sorry I ended up being way busier at work than I thought I would be. I have a semi working implementation without any additional tests so far. I think I should have something for you by this weekend at the latest. |
Allow new content types to be declared with custom handling for response creation and validation. Closes kenichi#22
I don't see how this is so difficult. I just solved it myself in a matter of minutes:
Usage:
Which reminds me: |
Yes, PRs are very welcome! |
I was working on adding support for handling arbitrary content types in responses and wanted to run my idea by you to see if you'd want it included in Angelo.
As far as I can tell only content types explicitly handled here and here are allowed in request handlers.
I'd like to a method to
Angelo::Base
that allows you to declare new content types in the body of the App class likeadd_content_type(type_alias, mime_type, klass=nil, &block)
. It would let you declare a symbol alias to use in request handlers, the associated mime type for the response header, and a lambda or class (with a.call(body)
instance method) to process the response body.For example if json handling wasn't built in it could be declared like this
or with a class
The text was updated successfully, but these errors were encountered: