Client SSL POST with Basic Authentication gives DEPTH_ZERO_SELF_SIGNED_CERT error

I am trying to do a method=POST on HTTPS against a Web server with self signed certificate. I downloaded the servers public certificate and put the path in post options. But I am getting error [Error: DEPTH_ZERO_SELF_SIGNED_CERT] on line 47. method=GET on HTTPS works ok for this web server with self signed certificate. What am I doing wrong?

var https = require('https');
var querystring = require('querystring');
var fs = require('fs');


console.log("Starting...");

var certFile = "self_signed_cert.pem"

function ssl_post() {
  var username = "user";
  var password = "password";

  var post_data = '';
  var basic = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
  // An object of options to indicate where to post to
  var post_options = {
      host: 'someservername',
      port: 443,
      path: '/add',
      method: 'POST',
      headers: {
          'accept': '*/*',
          'Content-Type': 'application/x-www-form-urlencoded',
          'Content-Length': post_data.length,
          'Authorization': basic,
          'ca': fs.readFileSync(certFile, 'utf8')
      }
  };
  // Set up the request
  var data = '';
  var post_req = https.request(post_options, function(res) {
      //res.setEncoding('utf8');
      res.on('data', function(res) {
            //res.setEncoding('utf8');
            res.on('data', function(chunk) {
              data += chunk;
            });
            res.on('end', function() {
              console.log(data);
            });
        });
  });
  post_req.on('error', function(e) {
    console.log(e);
  });
  // post the data
  post_req.write(post_data);
  post_req.end();
}


ssl_post();

console.log("Finished.");

You've put ca not directly into the post_options, but into the headers part. But, ca should not be used as a HTTP header so put it directly into post_options.