From 20dd851e075b18e1403e79f37d0e719aab39a3d8 Mon Sep 17 00:00:00 2001 From: Chris Fuller Date: Thu, 9 May 2013 11:59:43 +0100 Subject: [PATCH] Replacing createClient with http.request to remove deprecation warning --- plugins/internal-redirect.js | 3 +-- test.js | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/internal-redirect.js b/plugins/internal-redirect.js index 2d50108..088ccab 100644 --- a/plugins/internal-redirect.js +++ b/plugins/internal-redirect.js @@ -26,8 +26,7 @@ exports.run = function(api) { var rootRelUrl = pUrl.pathname; if (pUrl.search) rootRelUrl += pUrl.search; - var client = HTTP.createClient(port, hostname); - var clientReq = client.request('GET', rootRelUrl, { host: hostname }); + var clientReq = HTTP.request('GET', rootRelUrl, { host: hostname }); clientReq.end(); clientReq.on('response', function(resp) { var hts = new HTS.HttpTransactionState(); diff --git a/test.js b/test.js index 4188af2..5a64c21 100644 --- a/test.js +++ b/test.js @@ -25,7 +25,11 @@ HTTP.createServer(function(req, resp){ }).listen(8081); console.log('created test server'); -var cl = HTTP.createClient(8080, 'localhost'); +var options = { + hostname: 'localhost', + port: 8080 +}; +var req = HTTP.get(options); var req = cl.request('get', 'http://localhost:8081/', {host:'localhost'}); req.end();