You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/03/13 17:26:51 UTC

git commit: CIMI - slight hack to prefer content_type of xml when CIMI frontend is being used (and client specifies this as accepted type)

Updated Branches:
  refs/heads/master 1ef8d3729 -> cd8f41436


CIMI - slight hack to prefer content_type of xml when CIMI frontend
is being used (and client specifies this as accepted type)

HTML views for CIMI are being phased out...


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/cd8f4143
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/cd8f4143
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/cd8f4143

Branch: refs/heads/master
Commit: cd8f41436efba253345bf25113cbf16cea553a25
Parents: 1ef8d37
Author: marios <ma...@redhat.com>
Authored: Tue Mar 13 18:23:33 2012 +0200
Committer: marios <ma...@redhat.com>
Committed: Tue Mar 13 18:23:33 2012 +0200

----------------------------------------------------------------------
 server/lib/sinatra/rack_accept.rb |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/cd8f4143/server/lib/sinatra/rack_accept.rb
----------------------------------------------------------------------
diff --git a/server/lib/sinatra/rack_accept.rb b/server/lib/sinatra/rack_accept.rb
index b576307..2ad52c7 100644
--- a/server/lib/sinatra/rack_accept.rb
+++ b/server/lib/sinatra/rack_accept.rb
@@ -77,7 +77,10 @@ module Rack
             self[type] = handler
           end
           yield wants
-          @media_type = accepting_formats.to_a.sort { |a,b| a[1]<=>b[1] }.reverse.select do |format, priority|
+          if ENV['API_FRONTEND'] == "cimi"
+            @media_type = (accepting_formats.has_key?(:xml) ? [:xml, accepting_formats[:xml]] : nil)
+          end
+          @media_type ||= accepting_formats.to_a.sort { |a,b| a[1]<=>b[1] }.reverse.select do |format, priority|
             wants.keys.include?(format) == true
           end.first
           if @media_type and @media_type[0]