# Problem (and solution): ActiveMerchant and Ruby 1.8.4

**URL:** <https://www.ruby-forum.com/t/problem-and-solution-activemerchant-and-ruby-1-8-4/119522>\
**Category:** Rails\
**Created:** [November 7, 2007, 6:02pm UTC](https://www.ruby-forum.com/t/problem-and-solution-activemerchant-and-ruby-1-8-4/119522 "2007-11-07T18:02:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [November 7, 2007, 6:02pm UTC](https://www.ruby-forum.com/t/problem-and-solution-activemerchant-and-ruby-1-8-4/119522/1 "2007-11-07T18:02:15Z")

</div>

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 S.  
[www.buildingwebapps.com](http://www.buildingwebapps.com)
