feat: proxy和redirect拦截器,支持命名捕获组名称来设置占位符
parent
a8d5e831d4
commit
42224a4bf0
|
@ -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])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 移除多余的占位符
|
||||
|
|
Loading…
Reference in New Issue