title: node js http get returning error
body: <p>Here i am trying to do http get. But its returning following error.Please any one guide me to go with correct solution.</p>
  
  <pre><code>var https = require('http');
          var options = {
                host: 'lifecycle-dev.elasticbeanstalk.com',
                path: 'resource/validation?validationField=suffix',         //This is the only line that is new. `headers` is an object with the headers to request
                headers: {
                          'Content-Type': 'application/x-www-form-urlencoded',
                          /*'charset':'UTF-8'*/
              },
                method: 'GET'
      };
      callback = function(resp) {         
          console.log(resp);
      }   
  
      var req = https.request(options, callback);
      //req.write("grant_type=password&amp;username=baraffinity&amp;password=lalol1&amp;oauth_consumer_key=0mlvq6t6053e924864d4pw229h32b90a");
      req.end();
  </code></pre>
  
  <p>and the error is </p>
  
  <pre><code>        readingMore: false,
      decoder: null,
      encoding: null },
   readable: true,
   domain: null,
   _events:
    { end: [Object],
      finish: [Function: onSocketFinish],
      _socketEnd: [Function: onSocketEnd],
      free: [Function],
      close: [Object],
      agentRemove: [Function],
      drain: [Function: ondrain],
      error: [Function: socketErrorListener],
      connect: undefined },
   _maxListeners: 10,
   _writableState:
    { highWaterMark: 16384,
      objectMode: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      decodeStrings: false,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function],
      writecb: null,
      writelen: 0,
      buffer: [] },
   writable: true,
   allowHalfOpen: false,
   onend: [Function: socketOnEnd],
   destroyed: false,
   errorEmitted: false,
   bytesRead: 508,
   _bytesDispatched: 125,
   _pendingData: null,
   _pendingEncoding: '',
   parser:
    { _headers: [],
      _url: '',
      onHeaders: [Function: parserOnHeaders],
      onHeadersComplete: [Function: parserOnHeadersComplete],
      onBody: [Function: parserOnBody],
      onMessageComplete: [Function: parserOnMessageComplete],
      socket: [Circular],
      incoming: [Circular],
      maxHeaderPairs: 2000,
      onIncoming: [Function: parserOnIncomingClient] },
   _httpMessage:
    { domain: null,
      _events: [Object],
      _maxListeners: 10,
      output: [],
      outputEncodings: [],
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _hangupClose: false,
      socket: [Circular],
      connection: [Circular],
      agent: [Object],
      socketPath: undefined,
      method: 'GET',
      path: 'resource/validation?validationField=suffix',
      _headers: [Object],
      _headerNames: [Object],
      _header: 'GET resource/validation?validationField=suffix HTTP/1.1\r\nHo
  t: lifecycle-dev.elasticbeanstalk.com\r\nConnection: keep-alive\r\n\r\n',
      _headerSent: true,
      parser: [Object],
      res: [Circular] },
   ondata: [Function: socketOnData] },
  
  
  httpVersion: '1.1',
    complete: false,
    headers:
     { date: 'Thu, 31 Jul 2014 09:39:50 GMT',
       server: 'Apache/2.2.22 (Amazon)',
       'content-length': '326',
       connection: 'close',
       'content-type': 'text/html; charset=iso-8859-1' },
    trailers: {},
    _pendings: [],
    _pendingIndex: 0,
    url: '',
    method: null,
    statusCode: 400,
    client:
     { _connecting: false,
       _handle:
        { fd: null,
          writeQueueSize: 0,
          owner: [Circular],
          onread: [Function: onread],
          reading: true },
       _readableState:
        { highWaterMark: 16384,
          buffer: [],
          length: 0,
          pipes: null,
          pipesCount: 0,
          flowing: false,
          ended: false,
          endEmitted: false,
          reading: true,
          calledRead: true,
          sync: false,
          needReadable: true,
          emittedReadable: false,
          readableListening: false,
          objectMode: false,
          defaultEncoding: 'utf8',
          ranOut: false,
          awaitDrain: 0,
          readingMore: false,
          decoder: null,
          encoding: null },
       readable: true,
       domain: null,
       _events:
        { end: [Object],
          finish: [Function: onSocketFinish],
          _socketEnd: [Function: onSocketEnd],
          free: [Function],
          close: [Object],
          agentRemove: [Function],
          drain: [Function: ondrain],
          error: [Function: socketErrorListener],
          connect: undefined },
       _maxListeners: 10,
       _writableState:
        { highWaterMark: 16384,
          objectMode: false,
          needDrain: false,
          ending: false,
          ended: false,
          finished: false,
          decodeStrings: false,
          defaultEncoding: 'utf8',
          length: 0,
          writing: false,
          sync: false,
          bufferProcessing: false,
          onwrite: [Function],
          writecb: null,
          writelen: 0,
          buffer: [] },
       writable: true,
       allowHalfOpen: false,
       onend: [Function: socketOnEnd],
       destroyed: false,
       errorEmitted: false,
       bytesRead: 508,
       _bytesDispatched: 125,
       _pendingData: null,
       _pendingEncoding: '',
       parser:
        { _headers: [],
          _url: '',
          onHeaders: [Function: parserOnHeaders],
          onHeadersComplete: [Function: parserOnHeadersComplete],
          onBody: [Function: parserOnBody],
          onMessageComplete: [Function: parserOnMessageComplete],
          socket: [Circular],
          incoming: [Circular],
          maxHeaderPairs: 2000,
          onIncoming: [Function: parserOnIncomingClient] },
       _httpMessage:
        { domain: null,
          _events: [Object],
          _maxListeners: 10,
          output: [],
          outputEncodings: [],
          writable: true,
          _last: true,
          chunkedEncoding: false,
          shouldKeepAlive: false,
          useChunkedEncodingByDefault: false,
          sendDate: false,
          _hasBody: true,
          _trailer: '',
          finished: true,
          _hangupClose: false,
          socket: [Circular],
          connection: [Circular],
          agent: [Object],
          socketPath: undefined,
          method: 'GET',
          path: 'resource/validation?validationField=suffix',
          _headers: [Object],
          _headerNames: [Object],
          _header: 'GET resource/validation?validationField=suffix HTTP/1.1\r\nHo
  t: lifecycle-dev.elasticbeanstalk.com\r\nConnection: keep-alive\r\n\r\n',
          _headerSent: true,
          parser: [Object],
          res: [Circular] },
       ondata: [Function: socketOnData] },
    _consuming: false,
    _dumped: false,
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    upgrade: false,
    req:
     { domain: null,
       _events: { response: undefined, socket: undefined },
       _maxListeners: 10,
       output: [],
       outputEncodings: [],
       writable: true,
       _last: true,
       chunkedEncoding: false,
       shouldKeepAlive: false,
       useChunkedEncodingByDefault: false,
       sendDate: false,
       _hasBody: true,
       _trailer: '',
       finished: true,
       _hangupClose: false,
       socket:
        { _connecting: false,
          _handle: [Object],
          _readableState: [Object],
          readable: true,
          domain: null,
          _events: [Object],
          _maxListeners: 10,
          _writableState: [Object],
          writable: true,
          allowHalfOpen: false,
          onend: [Function: socketOnEnd],
          destroyed: false,
          errorEmitted: false,
          bytesRead: 508,
          _bytesDispatched: 125,
          _pendingData: null,
          _pendingEncoding: '',
          parser: [Object],
          _httpMessage: [Circular],
          ondata: [Function: socketOnData] },
       connection:
        { _connecting: false,
          _handle: [Object],
          _readableState: [Object],
          readable: true,
          domain: null,
          _events: [Object],
          _maxListeners: 10,
          _writableState: [Object],
          writable: true,
          allowHalfOpen: false,
          onend: [Function: socketOnEnd],
          destroyed: false,
          errorEmitted: false,
          bytesRead: 508,
          _bytesDispatched: 125,
          _pendingData: null,
          _pendingEncoding: '',
          parser: [Object],
          _httpMessage: [Circular],
          ondata: [Function: socketOnData] },
       agent:
        { domain: null,
          _events: [Object],
          _maxListeners: 10,
          options: {},
          requests: {},
          sockets: [Object],
          maxSockets: 5,
          createConnection: [Function] },
       socketPath: undefined,
       method: 'GET',
       path: 'resource/validation?validationField=suffix',
       _headers: { host: 'lifecycle-dev.elasticbeanstalk.com' },
       _headerNames: { host: 'Host' },
  </code></pre>