diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-08-08 16:15:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 16:15:45 +0800 |
commit | fc78423f1d9bfa10774a04563e37e130523bf46d (patch) | |
tree | b70264ddd42d8a7b778753c6c0eea8cd98a32f09 /test/fetch.js | |
parent | 2a5277b391f11e49306fb5a46f6037763916da4a (diff) | |
download | tracifyjs-fc78423f1d9bfa10774a04563e37e130523bf46d.tar.gz tracifyjs-fc78423f1d9bfa10774a04563e37e130523bf46d.zip |
clean up webkit quirks (#3229)
Diffstat (limited to 'test/fetch.js')
-rw-r--r-- | test/fetch.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/fetch.js b/test/fetch.js index eccdd71f..cd78d2d0 100644 --- a/test/fetch.js +++ b/test/fetch.js @@ -23,10 +23,9 @@ module.exports = function(url, callback) { var options = parse(url); options.rejectUnauthorized = false; require(options.protocol.slice(0, -1)).get(options, function(res) { - if (res.statusCode !== 200) return callback(res); - res.pipe(fs.createWriteStream(local(url)).on("close", function() { - callback(null, read(url)); - })); + if (res.statusCode !== 200) return callback(res.statusCode); + res.pipe(fs.createWriteStream(local(url))); + callback(null, res); }); }).on("open", function() { callback(null, result); |