diff --git a/agent/peering_endpoint.go b/agent/peering_endpoint.go index 3032422925..54cb0c37a8 100644 --- a/agent/peering_endpoint.go +++ b/agent/peering_endpoint.go @@ -48,7 +48,7 @@ func (s *HTTPHandlers) peeringRead(resp http.ResponseWriter, req *http.Request, return nil, err } if result.Peering == nil { - return nil, HTTPError{StatusCode: http.StatusNotFound} + return nil, HTTPError{StatusCode: http.StatusNotFound, Reason: fmt.Sprintf("Peering not found for %q", name)} } // TODO(peering): replace with API types diff --git a/agent/peering_endpoint_test.go b/agent/peering_endpoint_test.go index 345fac9e8e..fb441d136a 100644 --- a/agent/peering_endpoint_test.go +++ b/agent/peering_endpoint_test.go @@ -292,6 +292,7 @@ func TestHTTP_Peering_Read(t *testing.T) { resp := httptest.NewRecorder() a.srv.h.ServeHTTP(resp, req) require.Equal(t, http.StatusNotFound, resp.Code) + require.Equal(t, "Peering not found for \"baz\"", resp.Body.String()) }) }