mirror of https://github.com/hashicorp/consul
server: run the api checks against the path without params
parent
99f7a1219e
commit
3894d93d61
|
@ -90,6 +90,18 @@ func TestAgentEndpointsFailInV2(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Run("agent-self-with-params", func(t *testing.T) {
|
||||||
|
req, err := http.NewRequest("GET", "/v1/agent/self?dc=dc1", nil)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
resp := httptest.NewRecorder()
|
||||||
|
a.srv.h.ServeHTTP(resp, req)
|
||||||
|
require.Equal(t, http.StatusOK, resp.Code)
|
||||||
|
|
||||||
|
_, err = io.ReadAll(resp.Body)
|
||||||
|
require.NoError(t, err)
|
||||||
|
})
|
||||||
|
|
||||||
checkRequest("PUT", "/v1/agent/maintenance")
|
checkRequest("PUT", "/v1/agent/maintenance")
|
||||||
checkRequest("GET", "/v1/agent/services")
|
checkRequest("GET", "/v1/agent/services")
|
||||||
checkRequest("GET", "/v1/agent/service/web")
|
checkRequest("GET", "/v1/agent/service/web")
|
||||||
|
|
|
@ -396,7 +396,7 @@ func (s *HTTPHandlers) wrap(handler endpoint, methods []string) http.HandlerFunc
|
||||||
|
|
||||||
rejectCatalogV1Endpoint := false
|
rejectCatalogV1Endpoint := false
|
||||||
if s.agent.baseDeps.UseV2Resources() {
|
if s.agent.baseDeps.UseV2Resources() {
|
||||||
rejectCatalogV1Endpoint = isV1CatalogRequest(logURL)
|
rejectCatalogV1Endpoint = isV1CatalogRequest(req.URL.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.denylist.Block(req.URL.Path) {
|
if s.denylist.Block(req.URL.Path) {
|
||||||
|
|
Loading…
Reference in New Issue