Converts Ruby objects to JSON or XML based on accepts headers.
Ignores legal Rack responses like “string” and [“string”,“string”]
gem install raccept
# in config.ru use Raccept run lambda {|env| [200,{"Content-Type" => "text/plain"}, {:this => 'is a Hash'} ] } # Will respond with ... # Accepts application/xml or text/xml <?xml version="1.0" encoding="UTF-8"?> <hash> <this>is a Hash</this> </hash> # Accepts application/json or text/json {"this":"is a Hash"}
-
Get something leaner than ActiveSupport for to_xml?
-
Support custom objects somehow?
-
Add tests for it.
Copyright © 2009 Sam Schenkman-Moore. See LICENSE for details.