lib/grape/middleware/formatter.rb in grape-0.9.0 vs lib/grape/middleware/formatter.rb in grape-0.10.0

- old
+ new

@@ -24,11 +24,11 @@ end def after status, headers, bodies = *@app_response # allow content-type to be explicitly overwritten - api_format = mime_types[headers["Content-Type"]] || env['api.format'] + api_format = mime_types[headers['Content-Type']] || env['api.format'] formatter = Grape::Formatter::Base.formatter_for api_format, options begin bodymap = bodies.collect do |body| formatter.call body, env end @@ -46,13 +46,13 @@ end # store read input in env['api.request.input'] def read_body_input if (request.post? || request.put? || request.patch? || request.delete?) && - (!request.form_data? || !request.media_type) && - (!request.parseable_data?) && - (request.content_length.to_i > 0 || request.env['HTTP_TRANSFER_ENCODING'] == 'chunked') + (!request.form_data? || !request.media_type) && + (!request.parseable_data?) && + (request.content_length.to_i > 0 || request.env['HTTP_TRANSFER_ENCODING'] == 'chunked') if (input = env['rack.input']) input.rewind body = env['api.request.input'] = input.read begin @@ -111,10 +111,10 @@ end nil end def format_from_params - fmt = Rack::Utils.parse_nested_query(env['QUERY_STRING'])["format"] + fmt = Rack::Utils.parse_nested_query(env['QUERY_STRING'])['format'] # avoid symbol memory leak on an unknown format return fmt.to_sym if content_type_for(fmt) fmt end