@kaitranntt/ccs 7.79.1-dev.17 → 7.79.1-dev.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -639,7 +639,7 @@ function getTools() {
|
|
|
639
639
|
},
|
|
640
640
|
},
|
|
641
641
|
priority: { type: 'integer' },
|
|
642
|
-
action: { type: 'string', enum:
|
|
642
|
+
action: { type: 'string', enum: getInterceptActionEnum() },
|
|
643
643
|
statusCode: { type: 'integer', minimum: 100, maximum: 599 },
|
|
644
644
|
responseHeaders: {
|
|
645
645
|
type: 'array',
|
|
@@ -1292,9 +1292,30 @@ function parseOptionalPageId(toolArgs) {
|
|
|
1292
1292
|
: '';
|
|
1293
1293
|
}
|
|
1294
1294
|
|
|
1295
|
+
function getBrowserInterceptFulfillMode() {
|
|
1296
|
+
return String(process.env.CCS_BROWSER_INTERCEPT_FULFILL_MODE || 'disabled').trim() === 'enabled'
|
|
1297
|
+
? 'enabled'
|
|
1298
|
+
: 'disabled';
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function isBrowserInterceptFulfillEnabled() {
|
|
1302
|
+
return getBrowserInterceptFulfillMode() === 'enabled';
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
function getInterceptActionEnum() {
|
|
1306
|
+
return isBrowserInterceptFulfillEnabled()
|
|
1307
|
+
? ['continue', 'fail', 'fulfill']
|
|
1308
|
+
: ['continue', 'fail'];
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1295
1311
|
function parseInterceptAction(value) {
|
|
1312
|
+
if (value === 'fulfill' && !isBrowserInterceptFulfillEnabled()) {
|
|
1313
|
+
throw new Error(
|
|
1314
|
+
'action fulfill is disabled by CCS_BROWSER_INTERCEPT_FULFILL_MODE=disabled; set it to enabled only for trusted local testing'
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1296
1317
|
if (value !== 'continue' && value !== 'fail' && value !== 'fulfill') {
|
|
1297
|
-
throw new Error(
|
|
1318
|
+
throw new Error(`action must be one of: ${getInterceptActionEnum().join(', ')}`);
|
|
1298
1319
|
}
|
|
1299
1320
|
return value;
|
|
1300
1321
|
}
|