title: Javascript: buffer.js:202 Rest call throw new TypeError(kFromErrorMsg)
body: <p>Trying to perform first Rest call using javascript. My code is below:</p>
  
  <pre><code>        var https = require('https');
          var user =  '&lt;Domain&gt;\\*****';
          var pass = '******';
  
          process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
  
          /**
           * HOW TO Make an HTTP Call - GET
           */
          // options for GET
          var optionsget = {
              host : '**************', // here only the domain name
              // (no http/https !)
              port : 443,
              path : '/rest/api/latest/plan/dummy1/branch', // the rest of the url with parameters if needed
              method : 'GET', // do GET
              'Content-Type': 'application/json',
              Accept: 'application/json',
              auth : { 
                  username: user,
                  password: pass
              }   
          };
  
          console.info('Options prepared:');
          console.info(optionsget);
          console.info('Do the GET call');
  
          // do the GET request
          var reqGet = https.request(optionsget, function(res) {
              console.log("statusCode: ", res.statusCode);
              // uncomment it for header details
            console.log("headers: ", res.headers);
  
  
              res.on('data', function(d) {
                  console.info('GET result:\n');
                  process.stdout.write(d);
                  console.info('\n\nCall completed');
              });
  
          });
  
          reqGet.end();
          reqGet.on('error', function(e) {
              console.error(e);
          }); 
  </code></pre>
  
  <p>However above is generating error as below. Please help to understand this issue and how to fix it?</p>
  
  <hr>
  
  <p>Do the GET call
  ***buffer.js:202
    throw new TypeError(kFromErrorMsg);
    ^</p>
  
  <p>TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.</p>
  
  <pre><code>at Function.Buffer.from (buffer.js:202:9)
  at new ClientRequest (_http_client.js:198:27)
  at Object.request (http.js:38:10)
  at Object.request (https.js:239:15)
  at Object.&lt;anonymous&gt; (C:\som_temp\test.js:49:20)
  at Module._compile (module.js:643:30)
  at Object.Module._extensions..js (module.js:654:10)
  at Module.load (module.js:556:32)
  at tryModuleLoad (module.js:499:12)
  at Function.Module._load (module.js:491:3)***
  </code></pre>