From 938ed42ea4425a3cd973d914859e0767545040e0 Mon Sep 17 00:00:00 2001 From: Baris Date: Fri, 20 Jan 2017 00:54:56 +0200 Subject: [PATCH] rejectUnauthorized option for ssl issue if you want to make request with ssl may you get error message if your ssl service has a self signed certificate. You can fix this simple as below. find : this.withCredentials = false; insert new line after find: this.rejectUnauthorized = false; find: withCredentials: self.withCredentials, insert new line after find: rejectUnauthorized: self.rejectUnauthorized find: withCredentials: self.withCredentials, insert new line after find: rejectUnauthorized: self.rejectUnauthorized --- lib/XMLHttpRequest.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 4893913..da95e50 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -115,6 +115,7 @@ exports.XMLHttpRequest = function() { // Whether cross-site Access-Control requests should be made using // credentials such as cookies or authorization headers this.withCredentials = false; + this.rejectUnauthorized = false; /** * Private methods @@ -378,7 +379,8 @@ exports.XMLHttpRequest = function() { method: settings.method, headers: headers, agent: false, - withCredentials: self.withCredentials + withCredentials: self.withCredentials, + rejectUnauthorized: self.rejectUnauthorized }; // Reset error flag @@ -415,7 +417,8 @@ exports.XMLHttpRequest = function() { path: url.path, method: response.statusCode === 303 ? "GET" : settings.method, headers: headers, - withCredentials: self.withCredentials + withCredentials: self.withCredentials, + rejectUnauthorized: self.rejectUnauthorized }; // Issue the new request