mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
12 lines
377 B
TypeScript
12 lines
377 B
TypeScript
import { replaceTemplateTags } from "./templateTags";
|
|
|
|
export function validateHttpHeader(v: string): boolean {
|
|
if (v === "") {
|
|
return true;
|
|
}
|
|
|
|
// Template strings are not allowed so we replace them with a valid example string
|
|
const withoutTemplateStrings = replaceTemplateTags(v, () => "123");
|
|
return withoutTemplateStrings.match(/^[a-zA-Z0-9-_]+$/) !== null;
|
|
}
|