Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
controller: default to JSON for REST API
Browse files Browse the repository at this point in the history
If no request format is specified for an REST API call, default to
responding with JSON.

This commit fixes bug 1322543.

https://bugzilla.redhat.com/show_bug.cgi?id=1322543
  • Loading branch information
Miciah committed Mar 31, 2016
1 parent 84d6c56 commit 2fee966
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controller/lib/openshift/controller/api_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ module ApiBehavior

included do
before_filter ->{ Mongoid.identity_map_enabled = true }
before_filter :default_format_json
end

protected
attr :requested_api_version

def default_format_json
request.format ||= 'json'
end

def check_version
version = catch(:version) do
"#{request.accept},#{request.env['CONTENT_TYPE']}".split(',').each do |mime_type|
Expand Down

0 comments on commit 2fee966

Please sign in to comment.