Skip to content

Commit d11ec6b

Browse files
committed
chore: only error if there exist overrides
1 parent d2731d8 commit d11ec6b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/common/config/configOverrides.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ export function applyConfigOverrides({
2626
return baseConfig;
2727
}
2828

29-
// Only apply overrides if allowRequestOverrides is enabled
30-
if (!baseConfig.allowRequestOverrides) {
31-
throw new Error("Request overrides are not enabled");
32-
}
33-
3429
const result: UserConfig = { ...baseConfig };
3530
const overridesFromHeaders = extractConfigOverrides("header", request.headers);
3631
const overridesFromQuery = extractConfigOverrides("query", request.query);
3732

33+
// Only apply overrides if allowRequestOverrides is enabled
34+
if (
35+
!baseConfig.allowRequestOverrides &&
36+
(Object.keys(overridesFromHeaders).length > 0 || Object.keys(overridesFromQuery).length > 0)
37+
) {
38+
throw new Error("Request overrides are not enabled");
39+
}
40+
3841
// Apply header overrides first
3942
for (const [key, overrideValue] of Object.entries(overridesFromHeaders)) {
4043
assertValidConfigKey(key);

0 commit comments

Comments
 (0)