From 2f41cb42d7d290f4575659f35a0905999886a4dd Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Mon, 11 Jan 2016 21:32:38 +0200 Subject: [PATCH] Allow options.followRedirect if set to true --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1a77c6f..d1b952d 100644 --- a/index.js +++ b/index.js @@ -54,11 +54,14 @@ function request(options, callback) { if(typeof options.uri != "string") throw new Error("options.uri must be a string"); - var unsupported_options = ['proxy', '_redirectsFollowed', 'maxRedirects', 'followRedirect'] + var unsupported_options = ['proxy', '_redirectsFollowed', 'maxRedirects'] for (var i = 0; i < unsupported_options.length; i++) if(options[ unsupported_options[i] ]) throw new Error("options." + unsupported_options[i] + " is not supported") + if ('followRedirect' in options && !options.followRedirect) + throw new Error("options.followRedirect == false is not supported") + options.callback = callback options.method = options.method || 'GET'; options.headers = options.headers || {};