Skip to content

Commit

Permalink
feat: test 302 /ipns/{legacy-peerid} → /ipns/{cidv1-libp2p-key-base36} (
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias authored Aug 10, 2023
1 parent 815c9de commit d081741
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/path_gateway_ipns_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tests

import (
"testing"

"github.com/ipfs/gateway-conformance/tooling/specs"
. "github.com/ipfs/gateway-conformance/tooling/test"
)

func TestRedirectCanonicalIPNS(t *testing.T) {
tests := SugarTests{
{
Name: "GET for /ipns/{b58-multihash-of-ed25519-key} redirects to /ipns/{cidv1-libp2p-key-base36}",
Request: Request().
Path("/ipns/12D3KooWRBy97UB99e3J6hiPesre1MZeuNQvfan4gBziswrRJsNK/root2/"),
Response: Expect().
Status(302).
Headers(
Header("Location").Equals("/ipns/k51qzi5uqu5dlvj2baxnqndepeb86cbk3ng7n3i46uzyxzyqj2xjonzllnv0v8/root2/"),
),
},
{
Name: "GET for /ipns/{cidv0-like-b58-multihash-of-rsa-key} redirects to /ipns/{cidv1-libp2p-key-base36}",
Request: Request().
Path("/ipns/QmcJM7PRfkSbcM5cf1QugM5R37TLRKyJGgBEhXjLTB8uA2/root2/"),
Response: Expect().
Status(302).
Headers(
Header("Location").Equals("/ipns/k2k4r8ol4m8kkcqz509c1rcjwunebj02gcnm5excpx842u736nja8ger/root2/"),
),
},
}

RunWithSpecs(t, tests, specs.PathGatewayIPNS)
}

0 comments on commit d081741

Please sign in to comment.