title: Where set timeout with post request using request package in nodejs
body: <p>I am making a post request using <strong>request</strong> package. how can I set timeout 500 ms while requesting.</p>
  
  <pre><code>var request = require('request');
  
  request({
        url: 'myUrl',
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'authToken': 'myToken'
        },
        timeout: 500,
        json: infoObj
      })
        .on('response', function(response) {
          console.log('request response=============',response.statusCode)
  
        })
        .on('error', function(err) {
            console.log('error===',err);
        });
  </code></pre>
  
  <p>when tried using timeout: 500, above example got error </p>
  
  <blockquote>
    <p>{ Error: ETIMEDOUT
        at Timeout._onTimeout (F:\gomean\globeone\node_modules\request\request.js:796:17)
        at tryOnTimeout (timers.js:224:11)
        at Timer.listOnTimeout (timers.js:198:5) code: 'ETIMEDOUT', connect: true }</p>
  </blockquote>