1

I've run into an issue where when I run a constructed curl command the server response with a 204 (intended), but when I construct a Faraday object with the same configuration it fails with a 500 error - IIS

Missing required parameter

The curl command:

curl -v -i -H "Content-Type: application/xml" -H "HEADER1: VALUE" -H "HEADERSERVICENAME: VALUE" -X POST -d '<empty string>' HOST_GOES_HERE

My faraday code:

conn = Faraday.new <HOST_GOES_HERE>, :ssl => {:version => :SSLv3}
response = conn.post do |req|      
 req.headers['Content-Type'] = 'application/xml'
 req.headers['HEADER1'] = "VALUE"
 req.headers['HEADERSERVICENAME'] = "VALUE"
 req.body = ''
end

The only thing I can think of is if curl is sending some additional header that's not set in the curl command.

n0denine
  • 341
  • 2
  • 11

1 Answers1

1

Figured it out... The ruby http/net libraries capitalize the names of all headers

ruby net library

Unfortunately the API/service I'm using is case sensitive and requires the header to be in all caps...

n0denine
  • 341
  • 2
  • 11