From 8f62649e0a0f9ae988ce03e9cf87beb25e4deec8 Mon Sep 17 00:00:00 2001 From: jingdan Date: Thu, 3 May 2018 14:43:17 +0800 Subject: [PATCH] fix: if browser support AbortController api , stream-http timeout exception --- shims/xhr.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shims/xhr.js b/shims/xhr.js index e95685a95..199fb8836 100644 --- a/shims/xhr.js +++ b/shims/xhr.js @@ -4,6 +4,7 @@ var util = require('util'); var urlutil = require('url'); var http = require('http'); var https = require('https'); +var capability = require('stream-http/lib/capability'); var debug = require('debug')('urllib'); var ms = require('humanize-ms'); @@ -146,6 +147,10 @@ exports.requestWithCallback = function requestWithCallback(url, args, callback) options.requestTimeout = args.timeout; } + if (capability.abortController) { + options.mode = 'disable-fetch'; + } + var sslNames = [ 'pfx', 'key',