fix(proxy): restore header filtering and API matcher consistency

- Canonicalize filtered header deny-lists so Cloudflare and CDN headers are still removed

- Normalize incomplete API repo paths to stable owner-level matcher output regardless of trailing slash or query

- Add regression tests covering header canonicalization and incomplete API repo path parsing
This commit is contained in:
wjqserver 2026-04-12 07:17:59 +08:00
parent ba3dcf7624
commit e9e48fcefd
4 changed files with 73 additions and 9 deletions

View file

@ -151,7 +151,19 @@ func TestMatcher_Compatibility(t *testing.T) {
name: "API Repos Path (missing repo)",
rawPath: "https://api.github.com/repos/owner",
config: cfgWithAuth,
expectedUser: "", expectedRepo: "", expectedMatcher: "api",
expectedUser: "owner", expectedRepo: "", expectedMatcher: "api",
},
{
name: "API Repos Path (trailing slash)",
rawPath: "https://api.github.com/repos/owner/",
config: cfgWithAuth,
expectedUser: "owner", expectedRepo: "", expectedMatcher: "api",
},
{
name: "API Repos Path (missing repo with query)",
rawPath: "https://api.github.com/repos/owner?per_page=1",
config: cfgWithAuth,
expectedUser: "owner", expectedRepo: "", expectedMatcher: "api",
},
{
name: "API Users Path (exact user)",