test: sharness for ?uri= router
Additional tests to ensure there are no regressions, as this will be used by browser vendors in the future.
Marcin Rataj committed
Jan 13, 2021 at 16:41 UTC
cdad39479cb0f08e8a9c15be0009427b63c7e73f
1 file changed
+13
-1
test/sharness/t0114-gateway-subdomains.sh
+13
-1
@@ -379,7 +379,12 @@ test_expect_success "request for http://example.com/ipfs/{CID} with X-Forwarded-
379
test_should_contain \"Location: https://$CIDv1.ipfs.example.com/\" response
380
"
381
382
-
382
+# Support ipfs:// in https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
383
+test_hostname_gateway_response_should_contain \
384
+ "request for example.com/ipfs/?uri=ipfs%3A%2F%2F.. produces redirect to /ipfs/.. content path" \
385
+ "example.com" \
386
+ "http://127.0.0.1:$GWAY_PORT/ipfs/?uri=ipfs%3A%2F%2FQmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco%2Fwiki%2FDiego_Maradona.html" \
387
+ "Location: /ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/Diego_Maradona.html"
388
389
# example.com/ipns/<libp2p-key>
390
@@ -411,6 +416,13 @@ test_expect_success \
416
test_should_contain \"Location: https://en-wikipedia--on--ipfs-org.ipns.example.com/wiki\" response
417
"
418
419
+# Support ipns:// in https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
420
+test_hostname_gateway_response_should_contain \
421
+ "request for example.com/ipns/?uri=ipns%3A%2F%2F.. produces redirect to /ipns/.. content path" \
422
+ "example.com" \
423
+ "http://127.0.0.1:$GWAY_PORT/ipns/?uri=ipns%3A%2F%2Fen.wikipedia-on-ipfs.org" \
424
+ "Location: /ipns/en.wikipedia-on-ipfs.org"
425
+
426
# *.ipfs.example.com: subdomain requests made with custom FQDN in Host header
427
428
test_hostname_gateway_response_should_contain \