No description provided.
Strip the accept header value.
What problem does this fix? Where are you getting an accept header with leading or trailing spaces?
I'm a little concerned that your code will cause an exception if request.accept.first returns anything other than a string. This may be unlikely, but I don't see the point of adding that risk if this isn't fixing a known problem.
Also would you please add a test. api_request? is used by error_response, so if you stub a request that would otherwise return an error message, and pass in a content_type of ' text/html '. If there is a problem this should return a json response, and you're fix will cause it to return an html response.
Sorry for not adding any tests. The proplem I experienced was , that I installed a geminabox server localy on OSX 10.9.1 and when I uploaded a gem via web interface I got the massage "Gem xyz received and indexed.". So I tried to debug it and I found out that request.accept.first was "text/html" which should lead to a html response. The pull request is the first guess which worked for me. I'll write some tests and investigate a bit more what happend there.
@nevesenin good stuff. If you can add a test, I'll merge it in.
Use to_s instead of strip for accept header.
Added tests but there are still some error messages I didn't manage to get rid of yet.
BTW, I added some tests.;)
I can't see any problem with that, so have committed the merge. It won't get into the gem until the next update.