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(); + }); } };