Skip to content

Commit 3a83e05

Browse files
committed
chore: Version Bump v1.1.13 and update dist
1 parent 0f6dc56 commit 3a83e05

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

dist/components/proxy-middleware/rule_action_processor/handle_mixed_response.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3131
step((generator = generator.apply(thisArg, _arguments || [])).next());
3232
});
3333
};
34+
var __importDefault = (this && this.__importDefault) || function (mod) {
35+
return (mod && mod.__esModule) ? mod : { "default": mod };
36+
};
3437
Object.defineProperty(exports, "__esModule", { value: true });
3538
const axios = require("axios");
3639
const parser = require("ua-parser-js");
40+
const fs_1 = __importDefault(require("fs"));
3741
const Sentry = __importStar(require("@sentry/browser"));
3842
const handleMixedResponse = (ctx, destinationUrl) => __awaiter(void 0, void 0, void 0, function* () {
3943
var _a, _b, _c;
@@ -73,6 +77,34 @@ const handleMixedResponse = (ctx, destinationUrl) => __awaiter(void 0, void 0, v
7377
}
7478
}
7579
}
80+
if (destinationUrl === null || destinationUrl === void 0 ? void 0 : destinationUrl.startsWith("file://")) {
81+
const path = destinationUrl.slice(7);
82+
try {
83+
// utf-8 is common assumption, but this introduces edge cases
84+
const data = fs_1.default.readFileSync(path, "utf-8");
85+
return {
86+
status: true,
87+
response_data: {
88+
headers: { "Cache-Control": "no-cache" },
89+
status_code: 200,
90+
body: data,
91+
},
92+
};
93+
}
94+
catch (err) {
95+
Sentry.captureException(err);
96+
// log for live debugging
97+
console.log("error in openning local file", err);
98+
return {
99+
status: true,
100+
response_data: {
101+
headers: { "Cache-Control": "no-cache" },
102+
status_code: 502,
103+
body: err === null || err === void 0 ? void 0 : err.message,
104+
},
105+
};
106+
}
107+
}
76108
return { status: false };
77109
});
78110
exports.default = handleMixedResponse;

dist/components/proxy-middleware/rule_action_processor/processors/redirect_processor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const proxy_ctx_helper_1 = require("../../helpers/proxy_ctx_helper");
1717
const modified_requests_pool_1 = __importDefault(require("../modified_requests_pool"));
1818
const handle_mixed_response_1 = __importDefault(require("../handle_mixed_response"));
1919
const utils_1 = require("../utils");
20-
const { URL } = require("url");
2120
// adding util to get origin header for handling cors
2221
const getRequestOrigin = (ctx) => {
2322
const originalRequestHeaders = ctx.rq.original_request.headers || {};

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.1.12",
3+
"version": "1.1.13",
44
"description": "Proxy that gives superpowers to all the Requestly clients",
55
"main": "dist/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)