dvonlehman / express-request-proxy

Advanced streaming http request proxy middleware for Express with support for custom routes, caching, and response transforms.
95 stars 38 forks source link

GZipped content is not unzipped #22

Closed suchwerk closed 7 years ago

suchwerk commented 7 years ago

Is this behaviour by design?

For me this fix works:

Just copy the unzip pipe code from the proxyViaCache to makeApiCall function:

      // If the api response is gzip encoded, unzip it before attempting
      // any transforms.
      if (resp.headers['content-encoding'] === 'gzip') {
        apiRequest = apiRequest.pipe(zlib.createGunzip());
      }

      if (_.isArray(options.transforms)) {
        apiRequest = applyTransforms(apiRequest, options.transforms, resp.headers);
      }
suchwerk commented 7 years ago

Its by design.