Skip to content

Commit d081741

Browse files
authored
feat: test 302 /ipns/{legacy-peerid} → /ipns/{cidv1-libp2p-key-base36} (#136)
1 parent 815c9de commit d081741

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/path_gateway_ipns_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package tests
2+
3+
import (
4+
"testing"
5+
6+
"github.com/ipfs/gateway-conformance/tooling/specs"
7+
. "github.com/ipfs/gateway-conformance/tooling/test"
8+
)
9+
10+
func TestRedirectCanonicalIPNS(t *testing.T) {
11+
tests := SugarTests{
12+
{
13+
Name: "GET for /ipns/{b58-multihash-of-ed25519-key} redirects to /ipns/{cidv1-libp2p-key-base36}",
14+
Request: Request().
15+
Path("/ipns/12D3KooWRBy97UB99e3J6hiPesre1MZeuNQvfan4gBziswrRJsNK/root2/"),
16+
Response: Expect().
17+
Status(302).
18+
Headers(
19+
Header("Location").Equals("/ipns/k51qzi5uqu5dlvj2baxnqndepeb86cbk3ng7n3i46uzyxzyqj2xjonzllnv0v8/root2/"),
20+
),
21+
},
22+
{
23+
Name: "GET for /ipns/{cidv0-like-b58-multihash-of-rsa-key} redirects to /ipns/{cidv1-libp2p-key-base36}",
24+
Request: Request().
25+
Path("/ipns/QmcJM7PRfkSbcM5cf1QugM5R37TLRKyJGgBEhXjLTB8uA2/root2/"),
26+
Response: Expect().
27+
Status(302).
28+
Headers(
29+
Header("Location").Equals("/ipns/k2k4r8ol4m8kkcqz509c1rcjwunebj02gcnm5excpx842u736nja8ger/root2/"),
30+
),
31+
},
32+
}
33+
34+
RunWithSpecs(t, tests, specs.PathGatewayIPNS)
35+
}

0 commit comments

Comments
 (0)