mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-07 08:06:37 +08:00
fix(cap): keep only /api/v1/cap routes
Drop the unversioned /api/cap aliases so Challenge and Redeem exist only under /api/v1/cap.
This commit is contained in:
@@ -34,15 +34,18 @@ func TestApplyRegistersUnversionedCapRoutes(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := map[string]bool{
|
||||
"GET /api/v1/cap/challenge": false,
|
||||
"POST /api/v1/cap/challenge": false,
|
||||
"POST /api/cap/challenge": false,
|
||||
"POST /api/cap/redeem": false,
|
||||
"POST /api/v1/cap/redeem": false,
|
||||
}
|
||||
for _, rd := range ctx.Router().Routes() {
|
||||
key := rd.Method + " " + rd.Path
|
||||
if _, ok := want[key]; ok {
|
||||
want[key] = true
|
||||
}
|
||||
if key == "POST /api/cap/challenge" || key == "POST /api/cap/redeem" {
|
||||
t.Errorf("legacy route must not exist: %s", key)
|
||||
}
|
||||
}
|
||||
for key, ok := range want {
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user