From db8b189f2b46efb65d55db210da1a2ced1c45e1e Mon Sep 17 00:00:00 2001 From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:49:22 +0200 Subject: [PATCH] SNOW-896805: Add todo comment for gcp response customization on GZIP (#636) --- lib/http/base.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/http/base.js b/lib/http/base.js index 4e48a9056..3ad5c173c 100644 --- a/lib/http/base.js +++ b/lib/http/base.js @@ -82,6 +82,7 @@ HttpClient.prototype.request = function (options) // that we receive from GCS, so let's get response as arraybuffer and unzip it outside axios // issue in axios about case insensitive content-encoding is marked as won't fix: https://github.com/axios/axios/issues/4280 // for all other responses we manually parse jsons or other structures from the server so they need to be text + // TODO SNOW-917244 we can get rid of this logic when axios > 1.5.0 will be release as it should contain fix https://github.com/axios/axios/issues/5890 responseType: options.url.includes('storage.googleapis.com') ? 'arraybuffer' : 'text', }; @@ -109,6 +110,7 @@ HttpClient.prototype.request = function (options) // we request that GCS returns body as arraybuffer, not text // when it is GZIPped then we have to unzip it // otherwise we should convert arraybuffer to string + // TODO SNOW-917244 we can get rid of this logic when axios > 1.5.0 will be release as it should contain fix https://github.com/axios/axios/issues/5890 try { if (response.headers['content-encoding'] === 'GZIP') { const unzippedData = zlib.gunzipSync(response.data).toString('utf-8');