Hoist baseURL internal-whitespace regex constant

Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
Cursor Agent
2026-02-15 05:43:24 +00:00
parent c8bdcd935b
commit c82bf64db2
+3 -1
View File
@@ -457,6 +457,8 @@ const BASE_URL_VALIDATION_ERRORS = {
credentials: "baseURL must not include username or password credentials",
} as const;
const INTERNAL_WHITESPACE_REGEX = /\s/;
function resolvePayloadMapper<
UI_MESSAGE extends UIMessage,
PAYLOAD,
@@ -492,7 +494,7 @@ function normalizeBaseUrl(baseURL: string) {
}
function assertBaseUrlHasNoInternalWhitespace(baseUrl: string) {
if (/\s/.test(baseUrl)) {
if (INTERNAL_WHITESPACE_REGEX.test(baseUrl)) {
throw new Error(BASE_URL_VALIDATION_ERRORS.containsWhitespace);
}
}