Skip to content

Commit

Permalink
gateway: change status code of failed namesys resution to 500
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>


This commit was moved from ipfs/kubo@ce96b91
  • Loading branch information
Kubuxu authored and Lars Gierth committed Nov 16, 2016
1 parent d6d63af commit 557e5cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gateway/core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
dir = true
case namesys.ErrResolveFailed:
// Don't log that error as it is just noise
w.WriteHeader(http.StatusBadRequest)
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "Path Resolve error: %s", err.Error())
log.Info("Path Resolve error: %s", err.Error())
return
Expand Down
2 changes: 1 addition & 1 deletion gateway/core/corehttp/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,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, "Path Resolve error: " + namesys.ErrResolveFailed.Error()},
{"localhost:5001", "/ipns/nxdomain.example.com", http.StatusInternalServerError, "Path Resolve error: " + namesys.ErrResolveFailed.Error()},
{"localhost:5001", "/ipns/example.com", http.StatusOK, "fnord"},
{"example.com", "/", http.StatusOK, "fnord"},
} {
Expand Down

0 comments on commit 557e5cb

Please sign in to comment.