title: Twitter 1.1 user_timline with Bearer Authorization returns 400 in node.js
body: <p>I have a bearer token and try to get a user's timeline from behind a proxy with the following code.</p>
  
  <pre><code>var parsedUrl = url.parse( 'https://api.twitter.com/1.1/statuses/user_timeline.json:443/?count=2&amp;screen_name=twitterapi', true, true );
  var options = {
      'host': parsedUrl.host,
      'path': parsedUrl.path,
      'method': 'GET',
      'headers': {
          'Host': parsedUrl.host,
          'Authorization': 'Bearer ' + settings.accessToken
      }
  };
  
  var adapter = https;
  if(settings.proxy)
  {
      options.host = settings.proxy;
      options.port = settings.proxyPort;
      options.path = parsedUrl.path;
  
      options.headers['Proxy-Connection'] = 'Keep-Alive';
  
      adapter = http;
  }
  
  var body = '';
  var req = adapter.request(options, function(res) {
  
      res.on('data', function (chunk) {
          body += chunk;
      });
  
      res.on('end', function () {
          try
          {
              var result = JSON.parse( body );
          }
          catch(ex)
          {
           //...
          }
      });
  
  });
  req.end();
  </code></pre>
  
  <p>This request always return a 400 with no body or error message. If try the acces with cUrl it works like a charm. I retrieve the bearer token in the same way. Why does Twitter respond with a 400?</p>
  
  <pre><code>curl --get 'https://api.twitter.com/1.1/statuses/user_timeline.json' --data 'count=2&amp;screen_name=twitterapi' --header 'Authorization: Bearer &lt;token&gt;' --verbose --proxy http://proxy.example.com:8080
  </code></pre>
  
  <p>What does cUrl differently?</p>
  
  <p>EDIT: The status code is NOT 404 but 400! Sorry.</p>
  
  <p>EDIT2: When I leave the Authorization header out I still get 400 even though I expect a authorization failed message. Is any special enconding needed?</p>
  
  <p>EDIT3: Now the status code is 401. Something smelly goes on :(</p>