From 6321a0316a3b1247d4bc21a9fdc03e12a237cf65 Mon Sep 17 00:00:00 2001 From: yaoweiprc <6896642+yaoweiprc@users.noreply.github.com> Date: Fri, 7 Feb 2025 12:41:24 +0800 Subject: [PATCH] Support no-standard content-encoding response --- .../src/main/network/libcurl-promise.ts | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/insomnia/src/main/network/libcurl-promise.ts b/packages/insomnia/src/main/network/libcurl-promise.ts index 942fcbed420..9871b0f60fd 100644 --- a/packages/insomnia/src/main/network/libcurl-promise.ts +++ b/packages/insomnia/src/main/network/libcurl-promise.ts @@ -29,6 +29,8 @@ export interface CurlRequestOptions { caCertficatePath: string | null; socketPath?: string; authHeader?: { name: string; value: string }; + // make libcurl not decompress the response content + noDecompress?: boolean; } interface RequestUsedHere { headers: any; @@ -102,7 +104,7 @@ export const curlRequest = (options: CurlRequestOptions) => new Promise new Promise new Promise { const debugTimeline: ResponseTimelineEntry[] = []; const curl = new Curl(); curl.setOpt(Curl.option.URL, finalUrl); socketPath && curl.setOpt(Curl.option.UNIX_SOCKET_PATH, socketPath); - curl.setOpt(Curl.option.VERBOSE, true); // Set all the basic options - curl.setOpt(Curl.option.NOPROGRESS, true); // True so debug function works - curl.setOpt(Curl.option.ACCEPT_ENCODING, ''); // True so curl doesn't print progress + // Set all the basic options + + // True so debug function works + curl.setOpt(Curl.option.VERBOSE, true); + // True so curl doesn't print progress + curl.setOpt(Curl.option.NOPROGRESS, true); + // whether to decompress response content + curl.setOpt(Curl.option.ACCEPT_ENCODING, noDecompress ? null : ''); // fallback to root certificates or leave unset to use keychain on macOS if (caCert) { curl.setOpt(Curl.option.CAINFO_BLOB, caCert);