     method   : method
     auth     : API_KEY + ':'
     headers  :
-      accept           : 'application/xml'
-      'content-length' : data.length
+      Accept           : 'application/xml'
+      'Content-Length' : data.length
 
   if data.length > 0
-    options.headers['content-type'] = 'application/xml; charset=utf-8'
+    options.headers['Content-Type'] = 'application/xml; charset=UTF-8'
 
   req = https.request options, (res) ->
     res.setEncoding 'utf8'

            plans.push
              title      : p.name[0]
              code       : p.plan_code[0]
              desc       : if typeof p.description[0] is "string" then unescapeHTML p.description[0] else ""
              feeMonthly : parseInt p.unit_amount_in_cents[0]['USD'][0]['_']
              feeInitial : parseInt p.setup_fee_in_cents[0]['USD'][0]['_']
      callback no, plans

    else
      callback no, res

setBilling = (accountCode, data, callback) ->
  # Remove credit card number if it's not updated
  if data.cardNumber? and data.cardNumber.indexOf('...') > -1 or data.cardCV? and data.cardCV == 'XXX'
    delete data.cardNumber
    delete data.cardCV

  # See https://docs.recurly.com/api/account for XML format
  xml = """<?xml version="1.0" encoding="UTF-8"?>
            <billing_info>
             <number>#{data.cardNumber}</number>
             <verification_value>#{data.cardCV}</verification_value>
             <month>#{data.cardMonth}</month>
             <year>#{data.cardYear}</year>

             <first_name>#{escape data.cardFirstName}</first_name>
             <last_name>#{escape data.cardLastName}</last_name>
             <address1>#{escape data.address1}</address1>
             <address2>#{escape data.address2}</address2>
             <city>#{escape data.city}</city>
             <state>#{escape data.state}</state>
             <zip>#{data.zipCode}</zip>
             <country>#{escape data.country}</country>

             <ip_address>#{data.ipAddress}</ip_address>
            </billing_info>"""

  recurlyPut "accounts/#{accountCode}/billing_info", xml, (err, res) ->
    if err
      callback err, {}
    else
      callback no, res

setAccountWithBilling = (accountCode, data, callback) ->
  # Remove credit card number if it's not updated
  if data.cardNumber? and data.cardNumber.indexOf('...') > -1 or data.cardCV? and data.cardCV == 'XXX'
