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

Commit 2fee966

Browse files
committed
controller: default to JSON for REST API
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
1 parent 84d6c56 commit 2fee966

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

controller/lib/openshift/controller/api_behavior.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ module ApiBehavior
88

99
included do
1010
before_filter ->{ Mongoid.identity_map_enabled = true }
11+
before_filter :default_format_json
1112
end
1213

1314
protected
1415
attr :requested_api_version
1516

17+
def default_format_json
18+
request.format ||= 'json'
19+
end
20+
1621
def check_version
1722
version = catch(:version) do
1823
"#{request.accept},#{request.env['CONTENT_TYPE']}".split(',').each do |mime_type|

0 commit comments

Comments
 (0)