deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: [PATCH 3/3] CIMI - default to a content type for response when cimi request
Date Wed, 07 Nov 2012 09:19:30 GMT
self.NACK (reason inline) :)

On 07/11/12 10:22, marios@redhat.com wrote:
> 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

Dies pointed out on IRC that request.path.inclue is not the best test...

(10:34:13) dkoper: That said. the code... if
request.path.include?("cimi") , does that affect GET
/api/images/random_image_id_with_cimi_in_it?format=xml ?

Looking at [1] I think using request.env["SCRIPT_NAME"] is a safer bet.
going to resend these patches now.

marios


[1] http://rack.rubyforge.org/doc/SPEC.html


> +          #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
>  
> 


Mime
View raw message