You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/04/17 15:40:08 UTC

[PATCH core 29/32] Core: Respond with application/xml when no media type is negotiated

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@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 e4a0f1f..2064440 100644
--- a/server/lib/sinatra/rack_accept.rb
+++ b/server/lib/sinatra/rack_accept.rb
@@ -81,7 +81,11 @@ module Rack
           end.first
           if @media_type and @media_type[0]
             @media_type = @media_type[0]
-            headers 'Content-Type' => Rack::MediaType::ACCEPTED_MEDIA_TYPES[@media_type][:return]
+            if  Rack::MediaType::ACCEPTED_MEDIA_TYPES[@media_type]
+              headers 'Content-Type' => Rack::MediaType::ACCEPTED_MEDIA_TYPES[@media_type][:return]
+            else
+              headers 'Content-Type' => 'application/xml'
+            end
             wants[@media_type.to_sym].call if wants[@media_type.to_sym]
           else
             headers 'Content-Type' => nil
-- 
1.7.10