@cryptotaxi247 / kubo / commits / afd81fd5d

gateway test: document why .man

License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Oct 4, 2018 at 21:42 UTC afd81fd5dd973a065b7002fb4176f507a2c728df
1 file changed +6
core/corehttp/gateway_test.go
+6
@@ -153,6 +153,11 @@ func TestGatewayGet(t *testing.T) {
153 ns["/ipns/double.example.com"] = path.FromString("/ipns/working.example.com")
154 ns["/ipns/triple.example.com"] = path.FromString("/ipns/double.example.com")
155 ns["/ipns/broken.example.com"] = path.FromString("/ipns/" + k)
156 + // We picked .man because:
157 + // 1. It's a valid TLD.
158 + // 2. Go treats it as the file extension for "man" files (even though
159 + // nobody actually *uses* this extension, AFAIK).
160 + // 3. Go accepts "fnord" (the test value) as a valid man file.
161 ns["/ipns/example.man"] = path.FromString("/ipfs/" + k)
162
163 t.Log(ts.URL)
@@ -176,6 +181,7 @@ func TestGatewayGet(t *testing.T) {
181 {"working.example.com", "/ipfs/" + k, http.StatusNotFound, "ipfs resolve -r /ipns/working.example.com/ipfs/" + k + ": no link by that name\n"},
182 {"broken.example.com", "/", http.StatusNotFound, "ipfs resolve -r /ipns/broken.example.com/: " + namesys.ErrResolveFailed.Error() + "\n"},
183 {"broken.example.com", "/ipfs/" + k, http.StatusNotFound, "ipfs resolve -r /ipns/broken.example.com/ipfs/" + k + ": " + namesys.ErrResolveFailed.Error() + "\n"},
184 + // This test case ensures we don't treat the TLD as a file extension.
185 {"example.man", "/", http.StatusOK, "fnord"},
186 } {
187 var c http.Client