Skip to content

Commit

Permalink
Prioritize env API_FORMAT over Rack::CONTENT_TYPE header
Browse files Browse the repository at this point in the history
  • Loading branch information
trialize committed Oct 12, 2024
1 parent 277fe3e commit 9adf17c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/grape/middleware/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def build_formatted_response(status, headers, bodies)
end

def fetch_formatter(headers, options)
api_format = mime_types[headers[Rack::CONTENT_TYPE]] || env[Grape::Env::API_FORMAT]
api_format = env[Grape::Env::API_FORMAT] || mime_types[headers[Rack::CONTENT_TYPE]]
Grape::Formatter.formatter_for(api_format, options[:formatters])
end

Expand Down

0 comments on commit 9adf17c

Please sign in to comment.