Skip to content

Commit

Permalink
SNOW-896805: Add todo comment for gcp response customization on GZIP (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Sep 18, 2023
1 parent 472c467 commit db8b189
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/http/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit db8b189

Please sign in to comment.