Skip to content

Commit d788e77

Browse files
authored
chore: version bump to v1.3.4 (#53)
1 parent d364e49 commit d788e77

29 files changed

+288
-385
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export namespace RULE_ACTION {
2-
const REDIRECT: string;
3-
const MODIFY_HEADERS: string;
4-
const MODIFY_USER_AGENT: string;
5-
const BLOCK: string;
6-
const INSERT: string;
7-
const DELAY: string;
8-
const MODIFY_RESPONSE: string;
9-
const MODIFY_REQUEST: string;
2+
let REDIRECT: string;
3+
let MODIFY_HEADERS: string;
4+
let MODIFY_USER_AGENT: string;
5+
let BLOCK: string;
6+
let INSERT: string;
7+
let DELAY: string;
8+
let MODIFY_RESPONSE: string;
9+
let MODIFY_REQUEST: string;
1010
}
1111
export const RQ_INTERCEPTED_CONTENT_TYPES: string[];

dist/components/proxy-middleware/helpers/ctx_rq_namespace.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class CtxRQNamespace {
55
constructor() {
66
this.set_original_request = ({ method = null, path = null, host = null, port = null, headers = null, agent = null, body = null, query_params = null, }) => {
77
if (headers) {
8-
this.original_request.headers = Object.assign({}, headers);
8+
this.original_request.headers = { ...headers };
99
}
1010
this.original_request.method = method || this.original_request.method;
1111
this.original_request.path = path || this.original_request.path;
@@ -18,7 +18,7 @@ class CtxRQNamespace {
1818
};
1919
this.set_original_response = ({ status_code = null, headers = null, body = null, query_params = null, }) => {
2020
if (headers) {
21-
this.original_response.headers = Object.assign({}, headers);
21+
this.original_response.headers = { ...headers };
2222
}
2323
this.original_response.status_code =
2424
status_code || this.original_response.status_code;
@@ -27,7 +27,7 @@ class CtxRQNamespace {
2727
this.set_final_request = (proxyToServerRequestOptions) => {
2828
const { method, path, host, port, headers, agent, body, query_params, } = proxyToServerRequestOptions;
2929
if (headers) {
30-
this.final_request.headers = Object.assign({}, headers);
30+
this.final_request.headers = { ...headers };
3131
}
3232
this.final_request.method = method || this.final_request.method;
3333
this.final_request.path = path || this.final_request.path;
@@ -41,7 +41,7 @@ class CtxRQNamespace {
4141
};
4242
this.set_final_response = ({ status_code = null, headers = null, body = null, }) => {
4343
if (headers) {
44-
this.final_response.headers = Object.assign({}, headers);
44+
this.final_response.headers = { ...headers };
4545
}
4646
this.final_response.status_code =
4747
status_code || this.final_response.status_code;

dist/components/proxy-middleware/helpers/harObectCreator.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const createHarPostData = (body, headers) => {
8888
// };
8989
// }
9090
return {
91-
mimeType: contentType,
91+
mimeType: contentType, // Let's assume by default content type is JSON
9292
text: body,
9393
};
9494
};
@@ -97,10 +97,10 @@ const createHarPostData = (body, headers) => {
9797
const createRequestHarObject = (requestHarObject, proxyToServerRequestOptions) => {
9898
const { method, host, path, body, headers, agent, query_params } = proxyToServerRequestOptions;
9999
return {
100-
bodySize: -1,
101-
headersSize: -1,
100+
bodySize: -1, // TODO: calculate the body size
101+
headersSize: -1, // TODO: calculate the header size
102102
httpVersion: "HTTP/1.1",
103-
cookies: [],
103+
cookies: [], // TODO: add support for Cookies
104104
headers: requestHarObject.headers || createHarHeaders(headers),
105105
method: requestHarObject.method || method,
106106
queryString: requestHarObject.queryString || createHarQueryStrings(query_params),
@@ -140,10 +140,10 @@ const createHarEntry = (requestHeaders, method, protocol, host, path, requestBod
140140
exports.createHarEntry = createHarEntry;
141141
const createHarRequest = (requestHeaders, method, protocol, host, path, requestBody, requestParams) => {
142142
return {
143-
bodySize: -1,
144-
headersSize: -1,
143+
bodySize: -1, // TODO: calculate the body size
144+
headersSize: -1, // TODO: calculate the header size
145145
httpVersion: "HTTP/1.1",
146-
cookies: [],
146+
cookies: [], // TODO: add support for Cookies
147147
headers: createHarHeaders(requestHeaders),
148148
method: method,
149149
queryString: createHarQueryStrings(requestParams),

dist/components/proxy-middleware/helpers/proxy_ctx_helper.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
"use strict";
2-
// TODO: Removing this for now
3-
// import {
4-
// extractUrlComponent,
5-
// getQueryParamsMap,
6-
// } from "../../../../../../../common/components/utils/utils";
7-
// const CONSTANTS = require("../../../../../../../common/constants");
82
Object.defineProperty(exports, "__esModule", { value: true });
9-
exports.getResponseStatusCode = exports.getResponseContentTypeHeader = exports.getResponseHeaders = exports.getRequestContentTypeHeader = exports.getRequestHeaders = exports.get_json_query_params = exports.get_request_options = exports.get_response_options = exports.is_request_preflight = exports.get_original_response_headers = exports.get_original_request_headers = exports.get_request_url = exports.getQueryParamsMap = void 0;
3+
exports.getResponseStatusCode = exports.getResponseContentTypeHeader = exports.getResponseHeaders = exports.getRequestContentTypeHeader = exports.getRequestHeaders = exports.get_json_query_params = exports.get_request_options = exports.get_response_options = exports.is_request_preflight = exports.get_original_response_headers = exports.get_original_request_headers = exports.get_request_url = void 0;
4+
exports.getQueryParamsMap = getQueryParamsMap;
105
const requestly_core_1 = require("@requestly/requestly-core");
116
function extractUrlComponent(url, name) {
127
const myUrl = new URL(url);
@@ -49,7 +44,6 @@ function getQueryParamsMap(queryString) {
4944
});
5045
return map;
5146
}
52-
exports.getQueryParamsMap = getQueryParamsMap;
5347
const get_request_url = (ctx) => {
5448
return ((ctx.isSSL ? "https://" : "http://") +
5549
ctx.clientToProxyRequest.headers.host +
@@ -92,7 +86,10 @@ const get_response_options = (ctx) => {
9286
};
9387
exports.get_response_options = get_response_options;
9488
const get_request_options = (ctx) => {
95-
return Object.assign(Object.assign({}, ctx.proxyToServerRequestOptions), { query_params: (0, exports.get_json_query_params)(ctx) });
89+
return {
90+
...ctx.proxyToServerRequestOptions,
91+
query_params: (0, exports.get_json_query_params)(ctx),
92+
};
9693
};
9794
exports.get_request_options = get_request_options;
9895
const get_json_query_params = (ctx) => {

dist/components/proxy-middleware/helpers/rule_processor_helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class RuleProcessorHelper {
7979
const rule_action = rule_processor.process({
8080
rule,
8181
requestURL: this.request_data.request_url,
82-
details: Object.assign(Object.assign({}, this.request_data), { requestData }),
82+
details: { ...this.request_data, requestData },
8383
});
8484
return rule_action;
8585
};
@@ -94,7 +94,7 @@ class RuleProcessorHelper {
9494
const rule_action = rule_processor.process({
9595
rule,
9696
requestURL: this.request_data.request_url,
97-
details: Object.assign(Object.assign({}, this.request_data), { requestData }),
97+
details: { ...this.request_data, requestData },
9898
});
9999
return rule_action;
100100
};

dist/components/proxy-middleware/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export namespace MIDDLEWARE_TYPE {
2-
const AMIUSING: string;
3-
const RULES: string;
4-
const LOGGER: string;
5-
const SSL_CERT: string;
6-
const GLOBAL_STATE: string;
2+
let AMIUSING: string;
3+
let RULES: string;
4+
let LOGGER: string;
5+
let SSL_CERT: string;
6+
let GLOBAL_STATE: string;
77
}
88
export default ProxyMiddlewareManager;
99
declare class ProxyMiddlewareManager {

0 commit comments

Comments
 (0)