From b01ce193a567dcf3a7c2c62cff5d582f264daae2 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Sun, 10 Sep 2017 02:04:00 +1000 Subject: [PATCH] Allow overriding the used transport This allows users of axios inside `electron` to provide the [`net`](https://electron.atom.io/docs/api/net/) module as the http transport instead of using nodes http/https modules. This gives a whole bunch of things to Electron users including automatic proxy resolution. --- lib/adapters/http.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/adapters/http.js b/lib/adapters/http.js index af2f59dcd1..439bbe0f0e 100644 --- a/lib/adapters/http.js +++ b/lib/adapters/http.js @@ -117,7 +117,9 @@ module.exports = function httpAdapter(config) { } var transport; - if (config.maxRedirects === 0) { + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { transport = isHttps ? https : http; } else { if (config.maxRedirects) {