feat: proxy和redirect拦截器,支持命名捕获组名称来设置占位符

release-2.0.0.2
王良 2025-04-07 15:19:55 +08:00
parent a8d5e831d4
commit 42224a4bf0
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,11 @@ function replacePlaceholder (url, rOptions, matched) {
for (let i = 0; i < matched.length; i++) {
url = url.replace(`\${m[${i}]}`, matched[i] == null ? '' : matched[i])
}
if (matched.groups) {
for (const key in matched.groups) {
url = url.replace(`\${${key}}`, matched.groups[key] == null ? '' : matched.groups[key])
}
}
}
// 移除多余的占位符