@cryptotaxi247 / kubo / commits / ce96b915e

gateway: change status code of failed namesys resution to 500

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Oct 4, 2016 at 18:25 UTC ce96b915e75392baaa866b6f23e58f42f862f9d6
2 files changed +2 -2
core/corehttp/gateway_handler.go
+1 -1
@@ -168,7 +168,7 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
168 dir = true
169 case namesys.ErrResolveFailed:
170 // Don't log that error as it is just noise
171 - w.WriteHeader(http.StatusBadRequest)
171 + w.WriteHeader(http.StatusInternalServerError)
172 fmt.Fprintf(w, "Path Resolve error: %s", err.Error())
173 log.Info("Path Resolve error: %s", err.Error())
174 return
core/corehttp/gateway_test.go
+1 -1
@@ -136,7 +136,7 @@ func TestGatewayGet(t *testing.T) {
136 {"localhost:5001", "/", http.StatusNotFound, "404 page not found\n"},
137 {"localhost:5001", "/" + k, http.StatusNotFound, "404 page not found\n"},
138 {"localhost:5001", "/ipfs/" + k, http.StatusOK, "fnord"},
139 - {"localhost:5001", "/ipns/nxdomain.example.com", http.StatusBadRequest, "Path Resolve error: " + namesys.ErrResolveFailed.Error()},
139 + {"localhost:5001", "/ipns/nxdomain.example.com", http.StatusInternalServerError, "Path Resolve error: " + namesys.ErrResolveFailed.Error()},
140 {"localhost:5001", "/ipns/example.com", http.StatusOK, "fnord"},
141 {"example.com", "/", http.StatusOK, "fnord"},
142 } {