Skip to content

Commit 5d444fa

Browse files
authored
chore: release v1.3.6 (#58)
1 parent 8339cb3 commit 5d444fa

File tree

7 files changed

+32
-4
lines changed

7 files changed

+32
-4
lines changed

dist/components/proxy-middleware/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class ProxyMiddlewareManager {
236236
this.init_handlers = () => {
237237
this.proxy.onRequestHandlers = [];
238238
this.proxy.onConnectHandlers = [];
239-
this.proxy.use(proxy_1.default.gunzip);
239+
this.proxy.use(proxy_1.default.decompress);
240240
// this.init_ssl_tunneling_handler();
241241
this.init_amiusing_handler();
242242
this.init_ssl_cert_handler();

dist/lib/proxy/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export default DefaultExport;
2-
export { Proxy, PROXY_HANDLER_TYPE, gunzip, wildcard };
2+
export { Proxy, PROXY_HANDLER_TYPE, gunzip, decompress, wildcard };

dist/lib/proxy/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
2323
return result;
2424
};
2525
Object.defineProperty(exports, "__esModule", { value: true });
26-
exports.wildcard = exports.gunzip = exports.PROXY_HANDLER_TYPE = exports.Proxy = void 0;
26+
exports.wildcard = exports.decompress = exports.gunzip = exports.PROXY_HANDLER_TYPE = exports.Proxy = void 0;
2727
const proxy_1 = __importStar(require("./lib/proxy"));
2828
Object.defineProperty(exports, "Proxy", { enumerable: true, get: function () { return proxy_1.Proxy; } });
2929
Object.defineProperty(exports, "PROXY_HANDLER_TYPE", { enumerable: true, get: function () { return proxy_1.PROXY_HANDLER_TYPE; } });
3030
Object.defineProperty(exports, "gunzip", { enumerable: true, get: function () { return proxy_1.gunzip; } });
31+
Object.defineProperty(exports, "decompress", { enumerable: true, get: function () { return proxy_1.decompress; } });
3132
Object.defineProperty(exports, "wildcard", { enumerable: true, get: function () { return proxy_1.wildcard; } });
3233
exports.default = proxy_1.default;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export function onResponse(ctx: any, callback: any): any;
2+
export function onRequest(ctx: any, callback: any): any;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use strict";
2+
var zlib = require("zlib");
3+
const decompressMiddleware = {
4+
onResponse: function (ctx, callback) {
5+
if (ctx.serverToProxyResponse.headers["content-encoding"] &&
6+
ctx.serverToProxyResponse.headers["content-encoding"].toLowerCase() ==
7+
"gzip") {
8+
delete ctx.serverToProxyResponse.headers["content-encoding"];
9+
ctx.addResponseFilter(zlib.createGunzip());
10+
}
11+
else if (ctx.serverToProxyResponse.headers["content-encoding"] &&
12+
ctx.serverToProxyResponse.headers["content-encoding"].toLowerCase() ==
13+
"br") {
14+
delete ctx.serverToProxyResponse.headers["content-encoding"];
15+
ctx.addResponseFilter(zlib.createBrotliDecompress());
16+
}
17+
return callback();
18+
},
19+
onRequest: function (ctx, callback) {
20+
ctx.proxyToServerRequestOptions.headers["accept-encoding"] = "gzip";
21+
return callback();
22+
},
23+
};
24+
module.exports = decompressMiddleware;

dist/lib/proxy/lib/proxy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = function () {
2121
return new Proxy();
2222
};
2323
module.exports.gunzip = require("./middleware/gunzip");
24+
module.exports.decompress = require("./middleware/decompress");
2425
module.exports.wildcard = require("./middleware/wildcard");
2526
var Proxy = function () {
2627
this.onConnectHandlers = [];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestly/requestly-proxy",
3-
"version": "1.3.5",
3+
"version": "1.3.6",
44
"description": "Proxy that gives superpowers to all the Requestly clients",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)