fcoury / octopi

A Ruby interface to GitHub API v2
http://hasmany.info/2009/4/18/ruby-interface-to-github-api
MIT License
216 stars 47 forks source link

Small content type resolution issue with rails #48

Closed BRIMIL01 closed 13 years ago

BRIMIL01 commented 13 years ago

On line 198 of api.rb for some reason resp.headers['content-type'] is not an array as expected. I replaced line 198 with ctype = resp.headers['content-type'].to_a.first.split(";").first in my local gem and it seemed to resolve the problem. I have only encountered this issue when attempting to use this gem with rails.

radar commented 13 years ago

Could you provide more context with this error? How precisely are you using it with Rails?

BRIMIL01 commented 13 years ago

I want to pull a list of commits out of github. I have tried to integrate it into rails several ways but the easiest to recreate is running console, including Octopi and using one of the examples provided in the README. I get the following error back: Octopi::FormatError: Got unexpected format (got a for yaml). Upon further investigation it looks like in api.rb the content-type is expected to be an array but is a string instead (rails possibly does some modification to the response object).

krekoten commented 13 years ago

Fixed in #50. This bug was appearing under ruby 1.9.

radar commented 13 years ago

Thank you.

BRIMIL01 commented 13 years ago

Yes thank you