You want https://github.com/achiu/rack-parser with it you can declare the parsing strategies:
use Rack::Parser, :parsers => {
'application/json' => proc { |body| MyCustomJsonEngine.do_it body },
'application/xml' => proc { |body| MyCustomXmlEngine.decode body },
'application/roll' => proc { |body| 'never gonna give you up' }
}
However, it uses the content_type header. Because that's the correct header to put incoming mime type information. The Accepts header is what the user will accept as a response.