GET request, with data

What is the equivalent of the following browser-side GET request in Node?

jQuery.ajax({
    url: 'http://test.com',
    type: 'GET',
    data: myData,
    success: function(data) {
        console.log(data);
    }
});

My best attempt is

http.get('http://test.com', function(response) {
   response.on('data', function (chunk) {
      console.log(chunk);
   });
});

The problem is I don't know how to pass data: myData in the Node version. How can I pass data to http.get requests?

You have to pass it the full URL. you can create the URL by adding the query parameters yourself. There is a helper for making your own Query Strings. So it would be something like:

url = "http://test.com/?" + querystring.stringify(myData);
http.get(url, ...);

Remember that the get method is by url, so you can add it to the url if you want

http.get('http://test.com?GetVariable='+myVal, function(response) {
   response.on('data', function (chunk) {
      console.log(chunk);
   });
});