lib/grape/middleware/formatter.rb in grape-2.1.3 vs lib/grape/middleware/formatter.rb in grape-2.2.0
- old
+ new
@@ -52,11 +52,11 @@
throw :error, status: 500, message: e.message, backtrace: e.backtrace, original_exception: e
end
def fetch_formatter(headers, options)
api_format = mime_types[headers[Rack::CONTENT_TYPE]] || env[Grape::Env::API_FORMAT]
- Grape::Formatter.formatter_for(api_format, **options)
+ Grape::Formatter.formatter_for(api_format, options[:formatters])
end
# Set the content type header for the API format if it is not already present.
#
# @param headers [Hash]
@@ -95,10 +95,10 @@
# store parsed input in env['api.request.body']
def read_rack_input(body)
fmt = request.media_type ? mime_types[request.media_type] : options[:default_format]
throw :error, status: 415, message: "The provided content-type '#{request.media_type}' is not supported." unless content_type_for(fmt)
- parser = Grape::Parser.parser_for fmt, **options
+ parser = Grape::Parser.parser_for fmt, options[:parsers]
if parser
begin
body = (env[Grape::Env::API_REQUEST_BODY] = parser.call(body, env))
if body.is_a?(Hash)
env[Rack::RACK_REQUEST_FORM_HASH] = if env.key?(Rack::RACK_REQUEST_FORM_HASH)