deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 3/3] CIMI - default to a content type for response when cimi request
Date Wed, 07 Nov 2012 08:22:13 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/sinatra/rack_accept.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/lib/sinatra/rack_accept.rb b/server/lib/sinatra/rack_accept.rb
index 3be919c..9b915d0 100644
--- a/server/lib/sinatra/rack_accept.rb
+++ b/server/lib/sinatra/rack_accept.rb
@@ -79,7 +79,11 @@ module Rack
         end
         yield wants
 
-        if Deltacloud.default_frontend.name == :cimi
+        if request.path.include?("cimi") || Deltacloud.default_frontend.name == :cimi
+          #when cimi and neither json or xml defined... default to _something_  -  json?
+          if ([:json, :xml] & accepting_formats.keys).empty?
+            request.env['rack-accept.formats'] = {:json=>0}
+          end
           @media_type = (accepting_formats.has_key?(:xml) ? [:xml, accepting_formats[:xml]]
: nil)
         end if Deltacloud.respond_to? :default_frontend
 
-- 
1.7.11.7


Mime
View raw message