Skip to content

Commit 42224a4

Browse files
feat: proxy和redirect拦截器,支持命名捕获组名称来设置占位符
1 parent a8d5e83 commit 42224a4

File tree

1 file changed

+5
-0
lines changed
  • packages/mitmproxy/src/lib/interceptor/impl/req

1 file changed

+5
-0
lines changed

packages/mitmproxy/src/lib/interceptor/impl/req/proxy.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ function replacePlaceholder (url, rOptions, matched) {
1111
for (let i = 0; i < matched.length; i++) {
1212
url = url.replace(`\${m[${i}]}`, matched[i] == null ? '' : matched[i])
1313
}
14+
if (matched.groups) {
15+
for (const key in matched.groups) {
16+
url = url.replace(`\${${key}}`, matched.groups[key] == null ? '' : matched.groups[key])
17+
}
18+
}
1419
}
1520

1621
// 移除多余的占位符

0 commit comments

Comments
 (0)