Commit d20926f4 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #932 from andyleap/gateway404

Fixes issue #924
parents bcc8880a 512171aa
......@@ -174,15 +174,7 @@ func (i *gatewayHandler) getHandler(w http.ResponseWriter, r *http.Request) {
nd, p, err := i.ResolvePath(ctx, urlPath)
if err != nil {
if err == routing.ErrNotFound {
w.WriteHeader(http.StatusNotFound)
} else if err == context.DeadlineExceeded {
w.WriteHeader(http.StatusRequestTimeout)
} else {
w.WriteHeader(http.StatusBadRequest)
}
w.Write([]byte(err.Error()))
webError(w, "Path Resolve error", err, http.StatusBadRequest)
return
}
......
......@@ -91,7 +91,7 @@ func TestGatewayGet(t *testing.T) {
{"localhost:5001", "/", http.StatusNotFound, "404 page not found\n"},
{"localhost:5001", "/" + k, http.StatusNotFound, "404 page not found\n"},
{"localhost:5001", "/ipfs/" + k, http.StatusOK, "fnord"},
{"localhost:5001", "/ipns/nxdomain.example.com", http.StatusBadRequest, namesys.ErrResolveFailed.Error()},
{"localhost:5001", "/ipns/nxdomain.example.com", http.StatusBadRequest, "Path Resolve error: " + namesys.ErrResolveFailed.Error()},
{"localhost:5001", "/ipns/example.com", http.StatusOK, "fnord"},
{"example.com", "/", http.StatusOK, "fnord"},
} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment