From d4ab6f5cd961cd3c653b2d7e8c42f8ce68afa21c Mon Sep 17 00:00:00 2001 From: Isidro Vila Verde Date: Thu, 17 Jul 2014 21:02:54 +0100 Subject: [PATCH 1/3] delete date body on GET --- lib/restler.js | 1 + test/restler.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/restler.js b/lib/restler.js index 715845a..3e5c3f4 100644 --- a/lib/restler.js +++ b/lib/restler.js @@ -34,6 +34,7 @@ function Request(uri, options) { // set port and method defaults if (!this.url.port) this.url.port = (this.url.protocol == 'https:') ? '443' : '80'; if (!this.options.method) this.options.method = (this.options.data) ? 'POST' : 'GET'; + if (this.options.method === 'GET') delete this.options.data; if (typeof this.options.followRedirects == 'undefined') this.options.followRedirects = true; // stringify query given in options of not given in URL diff --git a/test/restler.js b/test/restler.js index 43b5320..5b66b5c 100644 --- a/test/restler.js +++ b/test/restler.js @@ -709,6 +709,13 @@ module.exports['Content-Length'] = { test.equal(0, data, 'should set content-length'); test.done(); }); + }, + + 'GET content length': function (test) { + rest.get(host).on('complete', function(data) { + test.equal(0, data, 'should be zero content-length'); + test.done(); + }); } }; From 90f4db930c9073e9d876a326427e15774824510f Mon Sep 17 00:00:00 2001 From: Isidro Vila Verde Date: Thu, 17 Jul 2014 21:28:54 +0100 Subject: [PATCH 2/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7bad79..22bc932 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "restler", - "version": "3.2.2", + "version": "3.2.2.a1", "description": "An HTTP client library for node.js", "contributors": [ { From 35f26c3efbfd1f012a2636746e2ae45fb3ab8f42 Mon Sep 17 00:00:00 2001 From: Isidro Vila Verde Date: Thu, 17 Jul 2014 22:16:40 +0100 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22bc932..d7bad79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "restler", - "version": "3.2.2.a1", + "version": "3.2.2", "description": "An HTTP client library for node.js", "contributors": [ {