Michael Slater
2007-Nov-07 17:01 UTC
Problem (and solution): ActiveMerchant and Ruby 1.8.4
I recently lost a few hours debugging a Ruby issue that I thought I''d post in the hope of saving someone else the time. Ruby 1.8.4''s net/http library has a bug in the post method: the content-type header is not set by default. This can cause ActiveMerchant transactions to be rejected by the gateway for mysterious reasons. The clean fix, if your server allows you to do so, is to upgrade to Ruby 1.8.5 or later. Alternatively, at the start of the ssl_post method (in ActiveMerchant''s posts_data.rb file), add this line at the start of the method: headers[''content-type''] = ''application/x-www-form-urlencoded'' Michael Slater www.buildingwebapps.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---