diff --git a/tsconsensus/http.go b/tsconsensus/http.go index cb4aeb628..ec7dd7cc1 100644 --- a/tsconsensus/http.go +++ b/tsconsensus/http.go @@ -104,7 +104,7 @@ func (h authedHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } allowed := h.auth.allowsHost(a) if !allowed { - http.Error(w, "peer not allowed", http.StatusUnauthorized) + http.Error(w, "peer not allowed", http.StatusForbidden) return } h.mux.ServeHTTP(w, r) diff --git a/tsconsensus/tsconsensus_test.go b/tsconsensus/tsconsensus_test.go index 327926f7a..5c2c27536 100644 --- a/tsconsensus/tsconsensus_test.go +++ b/tsconsensus/tsconsensus_test.go @@ -682,8 +682,8 @@ func TestOnlyTaggedPeersCanJoin(t *testing.T) { t.Fatal(err) } defer resp.Body.Close() - if resp.StatusCode != http.StatusUnauthorized { - t.Fatalf("join req when not tagged, expected status: %d, got: %d", http.StatusUnauthorized, resp.StatusCode) + if resp.StatusCode != http.StatusForbidden { + t.Fatalf("join req when not tagged, expected status: %d, got: %d", http.StatusForbidden, resp.StatusCode) } rBody, _ := io.ReadAll(resp.Body) sBody := strings.TrimSpace(string(rBody))