gitlab_monitor/utils/pathTools.ts
zhaoyingbo 8944791419
Some checks failed
CI Monitor CI/CD / build-image (push) Successful in 31s
CI Monitor MIflow / build-image (push) Successful in 34s
CI Monitor CI/CD / deploy (push) Failing after 1m5s
feat: 添加路径检查工具函数
为了支持路由前缀功能,添加了一个路径检查工具函数`makeCheckPathTool`,用于检查请求的路径是否匹配指定的前缀。
2024-07-26 09:27:45 +00:00

5 lines
166 B
TypeScript

export const makeCheckPathTool = (url: string, prefix: string) => {
const { pathname } = new URL(url)
return (path: string) => pathname === `${prefix}/${path}`
}