From 69ad0039689b2183bfec55bd47990f1789c2e1a5 Mon Sep 17 00:00:00 2001 From: Jingdan Date: Tue, 8 May 2018 10:55:47 +0800 Subject: [PATCH] fix: if browser support AbortController api , stream-http timeout err (#466) --- 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',