From 9c9aac8631e1106cef1918d63ce458eee89b9804 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 11 Sep 2019 14:05:38 +0100 Subject: [PATCH] fix: big downloads in electron License: MIT Signed-off-by: Alan Shaw --- src/lib/error-handler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/error-handler.js b/src/lib/error-handler.js index 85e207831..88754e7aa 100644 --- a/src/lib/error-handler.js +++ b/src/lib/error-handler.js @@ -2,7 +2,7 @@ const { HTTPError } = require('ky-universal') const log = require('debug')('ipfs-http-client:lib:error-handler') -const { isNode } = require('ipfs-utils/src/env') +const { isNode, isElectron } = require('ipfs-utils/src/env') function isJsonResponse (res) { return (res.headers.get('Content-Type') || '').startsWith('application/json') @@ -18,7 +18,7 @@ module.exports = async function errorHandler (input, options, response) { // // If the body in the clone is not consumed or destroyed the highwater mark // will be reached (for large payloads) and stop the real body from flowing. - if (isNode) response.body.destroy() + if (isNode || isElectron) response.body.destroy() return }