signal-desktop/patches/got+11.8.5.patch

45 lines
1.9 KiB
Diff
Raw Normal View History

2021-12-21 21:49:54 +00:00
diff --git a/node_modules/got/dist/source/as-promise/index.js b/node_modules/got/dist/source/as-promise/index.js
2022-06-27 22:00:07 +00:00
index b4026d3..a473860 100644
2021-12-21 21:49:54 +00:00
--- a/node_modules/got/dist/source/as-promise/index.js
+++ b/node_modules/got/dist/source/as-promise/index.js
@@ -33,6 +33,7 @@ function asPromise(normalizedOptions) {
const promise = new PCancelable((resolve, reject, onCancel) => {
const makeRequest = (retryCount) => {
const request = new core_1.default(undefined, normalizedOptions);
+ let isResolved = false;
request.retryCount = retryCount;
request._noPipe = true;
onCancel(() => request.destroy());
2022-06-27 22:00:07 +00:00
@@ -114,6 +115,7 @@ function asPromise(normalizedOptions) {
2021-12-21 21:49:54 +00:00
return;
}
globalResponse = response;
+ isResolved = true;
2022-06-27 22:00:07 +00:00
if (!is_response_ok_1.isResponseOk(response)) {
request._beforeError(new types_1.HTTPError(response));
return;
2021-12-21 21:49:54 +00:00
@@ -127,9 +129,11 @@ function asPromise(normalizedOptions) {
const { options } = request;
if (error instanceof types_1.HTTPError && !options.throwHttpErrors) {
const { response } = error;
+ isResolved = true;
resolve(request.options.resolveBodyOnly ? response.body : response);
return;
}
+ isResolved = true;
reject(error);
};
request.once('error', onError);
@@ -140,7 +144,10 @@ function asPromise(normalizedOptions) {
onError(error);
return;
}
- makeRequest(newRetryCount);
+
+ if (!isResolved) {
+ makeRequest(newRetryCount);
+ }
});
proxy_events_1.default(request, emitter, proxiedRequestEvents);
};