Skip to content

Commit 2ff85f1

Browse files
chore(release): v1.3.13 (#82)
Co-authored-by: wrongsahil <16779465+wrongsahil@users.noreply.github.com>
1 parent ae3cc81 commit 2ff85f1

7 files changed

Lines changed: 45 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
3+
## [1.3.13](https://github.com/requestly/rq-proxy/compare/v1.3.12...v1.3.13) (2026-01-05)
4+
5+
6+
### 🐛 Bug Fixes
7+
8+
* fix: support 204 in API Client via proxy (#73) ([](https://github.com/requestly/rq-proxy/commit/b5fdd94e5eae1c22c39b7a7f48a61eaf34102938)), closes [#73](https://github.com/requestly/rq-proxy/issues/73)
9+
10+
11+
### 🔧 Chores
12+
13+
* [ENGG-5086] chore: improve content-type logic for body parsing (#74) ([](https://github.com/requestly/rq-proxy/commit/b0e812f4dc8b0fb4e8fa559c447bb56451477205)), closes [#74](https://github.com/requestly/rq-proxy/issues/74)
14+
* chore: added pipelines for release (#75) ([](https://github.com/requestly/rq-proxy/commit/78b2507e9b061b09f8350580707bd374b91a9c97)), closes [#75](https://github.com/requestly/rq-proxy/issues/75)
15+
* chore: update package-lock (#76) ([](https://github.com/requestly/rq-proxy/commit/bdf61520608c6f7106dc0d30c57344db4799a3bb)), closes [#76](https://github.com/requestly/rq-proxy/issues/76)
16+
* chore: update package-lock (#77) ([](https://github.com/requestly/rq-proxy/commit/c31b2a35fe1da1792421f4347e81433f86d16938)), closes [#77](https://github.com/requestly/rq-proxy/issues/77)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ export namespace RULE_ACTION {
99
let MODIFY_REQUEST: string;
1010
}
1111
export const RQ_INTERCEPTED_CONTENT_TYPES: string[];
12+
export const RQ_INTERCEPTED_CONTENT_TYPES_REGEX: RegExp;

dist/components/proxy-middleware/constants.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.RQ_INTERCEPTED_CONTENT_TYPES = exports.RULE_ACTION = void 0;
3+
exports.RQ_INTERCEPTED_CONTENT_TYPES_REGEX = exports.RQ_INTERCEPTED_CONTENT_TYPES = exports.RULE_ACTION = void 0;
44
exports.RULE_ACTION = {
55
REDIRECT: "redirect",
66
MODIFY_HEADERS: "modify_headers",
@@ -22,3 +22,15 @@ exports.RQ_INTERCEPTED_CONTENT_TYPES = [
2222
"application/json",
2323
"application/manifest+json"
2424
];
25+
exports.RQ_INTERCEPTED_CONTENT_TYPES_REGEX = new RegExp([
26+
'text/html', // HTML documents
27+
'text/plain', // Plain text
28+
'text/javascript', // JavaScript files
29+
'application/javascript', // JavaScript (standard MIME)
30+
'application/x-javascript', // JavaScript (legacy)
31+
'text/css', // CSS files
32+
'application/css', // CSS (alternative)
33+
'application/json', // JSON data
34+
'application/.+\\+json', // JSON-based media types (including vendor-specific like application/vnd.*)
35+
].join('|'), 'i');
36+
// console.log(RQ_INTERCEPTED_CONTENT_TYPES_REGEX);

dist/components/proxy-middleware/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class ProxyMiddlewareManager {
147147
ctx.rq.set_original_request({ body: pre_final_body });
148148
ctx.rq_request_body = pre_final_body;
149149
let request_rule_applied = false;
150-
if (parsedBody && constants_1.RQ_INTERCEPTED_CONTENT_TYPES.includes(contentType)) {
150+
if (parsedBody && constants_1.RQ_INTERCEPTED_CONTENT_TYPES_REGEX.test(contentType)) {
151151
// Do modifications, if any
152152
const { action_result_objs, continue_request } = await rules_middleware.on_request_end(ctx);
153153
if (!continue_request) {
@@ -189,13 +189,21 @@ class ProxyMiddlewareManager {
189189
ctx.rq_response_body = body;
190190
ctx.rq_parsed_response_body = parsedBody;
191191
ctx.rq_response_status_code = (0, proxy_ctx_helper_1.getResponseStatusCode)(ctx);
192-
if (constants_1.RQ_INTERCEPTED_CONTENT_TYPES.includes(contentType) && parsedBody) {
192+
if (constants_1.RQ_INTERCEPTED_CONTENT_TYPES_REGEX.test(contentType) && parsedBody) {
193193
ctx.rq_response_body = parsedBody;
194194
ctx.rq.set_original_response({ body: parsedBody });
195195
}
196196
const { action_result_objs, continue_request } = await rules_middleware.on_response_end(ctx);
197197
const statusCode = ctx.rq_response_status_code || (0, proxy_ctx_helper_1.getResponseStatusCode)(ctx);
198-
ctx.proxyToClientResponse.writeHead(statusCode, http_1.default.STATUS_CODES[statusCode], (0, proxy_ctx_helper_1.getResponseHeaders)(ctx));
198+
const responseHeaders = (0, proxy_ctx_helper_1.getResponseHeaders)(ctx);
199+
// For 204/304/1xx, remove content headers to prevent errors
200+
if (statusCode === 204 || statusCode === 304 || (statusCode >= 100 && statusCode < 200)) {
201+
delete responseHeaders['content-length'];
202+
delete responseHeaders['Content-Length'];
203+
delete responseHeaders['transfer-encoding'];
204+
delete responseHeaders['Transfer-Encoding'];
205+
}
206+
ctx.proxyToClientResponse.writeHead(statusCode, http_1.default.STATUS_CODES[statusCode], responseHeaders);
199207
ctx.proxyToClientResponse.write(ctx.rq_response_body);
200208
ctx.rq.set_final_response({
201209
...(0, proxy_ctx_helper_1.get_response_options)(ctx),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const process_modify_response_action = async (action, ctx) => {
6363
action.responseType === requestly_core_1.CONSTANTS.RESPONSE_BODY_TYPES.CODE) {
6464
const contentTypeHeader = (0, proxy_ctx_helper_1.getResponseContentTypeHeader)(ctx);
6565
const contentType = (0, http_helpers_1.getContentType)(contentTypeHeader);
66-
if (constants_1.RQ_INTERCEPTED_CONTENT_TYPES.includes(contentType) || contentType == null) {
66+
if (constants_1.RQ_INTERCEPTED_CONTENT_TYPES_REGEX.test(contentType) || contentType == null) {
6767
await modify_response_using_code(action, ctx);
6868
delete_breaking_headers(ctx);
6969
return (0, utils_1.build_action_processor_response)(action, true);

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.3.12",
3+
"version": "1.3.13",
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)