0

Why does requestify.request() crash because it doesn't think it was given the method POST

var postBody = querystring.stringify(dat);

var postOptions = {
    host: 'https://www.example.com'
    , path: '/admin'
    , method: 'post' // POST, 'POST', post
    , headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postBody) }
};

var postReq = requestify.request(postOptions, function (err, resp, respBody) {
    resp.setEncoding('utf8');
    resp.on('data', function (chunk) {
        console.log('Response: ' + chunk);
    });
});
Steve
  • 905
  • 1
  • 8
  • 32

1 Answers1

0

It looks like you are using an old version of the documentation for the newer version of requestify

Read the API reference section of https://github.com/ranm8/requestify

And read just a little lower down it see a requestify.request() example.

Options doesn't have host, path, ...

Steve
  • 905
  • 1
  • 8
  • 32