title: Send an http get request with parameters in Node.js
body: <p>I'm trying to send a GET request from a Node.js app to a Rails server. Currently, I am using the <code>request</code> module like so:</p>
  
  <pre><code>var request = require("request");
  var url = 'www.example.com'
  
  function sendRequest(url){
    string = 'http://localhost:3000/my-api-controller?url=' + url;
    request.get(string, function(error, response, body){
      console.log(body);
    });
  }
  </code></pre>
  
  <p>This works. But what I would like is not to build the <code>string</code> for a <code>get</code> request, but to pass parameters of the request as a javascript object (in a jQuery-like fashion). There is <a href="https://github.com/request/request#http-authentication" rel="noreferrer">one example</a> on the wiki page of the <code>request</code> module that uses exactly this kind of syntax:</p>
  
  <pre><code>request.get('http://some.server.com/', {
    'auth': {
      'user': 'username',
      'pass': 'password',
      'sendImmediately': false
    }
  });
  </code></pre>
  
  <p>However, when I tried to adapt this syntax for my purposes like so:</p>
  
  <pre><code>function sendRequest(url){
    request.get('http://localhost:3000/my-api-controller', {url: url}, function(error, response, body){
      console.log(body);
    });
  }
  </code></pre>
  
  <p>the <code>url</code> parameter did not get sent.</p>
  
  <p>So my question is, am I doing something wrong here or does the <code>request</code> module not support passing parameters of a <code>get</code> request as a javascript object? And if it doesn't, could you suggest a handy Node module that does?</p>