On Mon, Sep 15, 2008 at 9:32 AM, edgarjs <[EMAIL PROTECTED]> wrote:
>
> I made a plugin for the YouTube API back in Rails' version 2.0.2 and
> it was working good enough. Now I decided to try it in version 2.1.1
> and it returns a 406 http error always.
>
> So I tracked the issue and found that from version 2.1.0 to 2.1.1
> there was a change in the
> ActiveResource::Connection#build_request_headers method that updates
> the request's header to "application/xml" by default with the GET http
> method.
>
> I really apologize for my english, I think it will be more clear with
> an example:
>
>
> Rails v 2.1.0:
>
> module ActiveResource
>  class Connection
>    #.....
>    def build_request_headers(headers)
>      authorization_header.update(default_header).update(headers)
>    end
>  end
> end
>
>
> Rails v 2.1.1:
>
> module ActiveResource
>  class Connection
>    #.....
>    def build_request_headers(headers, http_method=nil)
>
> authorization_header.update(default_header).update(headers).update(http_format_header(http_method))
>    end
>
>    def http_format_header(http_method)
>      {HTTP_FORMAT_HEADER_NAMES[http_method] => format.mime_type}
>    end
>  end
> end
>
> So it's like if we were doing
>
>  connection.get('http://gdata.youtube.com/feeds/api/videos?vq=rails',
> 'Accept' => 'application/xml')
>
> and this causes a 406 http error always.... at least from YouTube API
>
>
> Regards.

This would appear to be caused by:

http://github.com/rails/rails/commit/caabe228bc6c6e920043334d717e72093559e118

Could you submit a patch which includes a failing test case?

-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to