diff --git a/server/fleet/service.go b/server/fleet/service.go index c2fd19ed44..6bcb8e58eb 100644 --- a/server/fleet/service.go +++ b/server/fleet/service.go @@ -307,7 +307,7 @@ type Service interface { // ListDevicePolicies lists all policies for the given host, including passing / failing summaries ListDevicePolicies(ctx context.Context, host *Host) ([]*HostPolicy, error) - // DisableAuthForPing is used by the /orbit_ping and /device_ping endpoints + // DisableAuthForPing is used by the /orbit/ping and /device/ping endpoints // to bypass authentication, as they are public DisableAuthForPing(ctx context.Context) diff --git a/server/service/base_client_test.go b/server/service/base_client_test.go index 85da56b50b..25eb3ede2b 100644 --- a/server/service/base_client_test.go +++ b/server/service/base_client_test.go @@ -4,6 +4,7 @@ import ( "bytes" "io" "net/http" + "strings" "testing" "github.com/fleetdm/fleet/v4/server/fleet" @@ -131,7 +132,7 @@ func TestClientCapabilities(t *testing.T) { var req http.Request bc.setClientCapabilitiesHeader(&req) - require.Equal(t, c.expected, req.Header.Get(fleet.CapabilitiesHeader)) + require.ElementsMatch(t, strings.Split(c.expected, ","), strings.Split(req.Header.Get(fleet.CapabilitiesHeader), ",")) }) } } diff --git a/server/service/handler.go b/server/service/handler.go index cd7cd62e34..e2dc4f933c 100644 --- a/server/service/handler.go +++ b/server/service/handler.go @@ -506,11 +506,11 @@ func attachFleetAPIRoutes(r *mux.Router, svc fleet.Service, config config.FleetC ne.WithCustomMiddleware( errorLimiter.Limit("ping_device", desktopQuota), - ).HEAD("/api/_version_/fleet/device_ping", devicePingEndpoint, devicePingRequest{}) + ).HEAD("/api/fleet/device/ping", devicePingEndpoint, devicePingRequest{}) ne.WithCustomMiddleware( errorLimiter.Limit("ping_orbit", desktopQuota), - ).HEAD("/api/_version_/fleet/orbit_ping", orbitPingEndpoint, orbitPingRequest{}) + ).HEAD("/api/fleet/orbit/ping", orbitPingEndpoint, orbitPingRequest{}) } diff --git a/server/service/integration_core_test.go b/server/service/integration_core_test.go index a4380e8c9d..5dc887030f 100644 --- a/server/service/integration_core_test.go +++ b/server/service/integration_core_test.go @@ -5569,13 +5569,13 @@ func (s *integrationTestSuite) TestOSVersions() { } func (s *integrationTestSuite) TestPingEndpoints() { - s.DoRaw("HEAD", "/api/latest/fleet/orbit_ping", nil, http.StatusOK) + s.DoRaw("HEAD", "/api/fleet/orbit/ping", nil, http.StatusOK) // unauthenticated works too - s.DoRawNoAuth("HEAD", "/api/latest/fleet/orbit_ping", nil, http.StatusOK) + s.DoRawNoAuth("HEAD", "/api/fleet/orbit/ping", nil, http.StatusOK) - s.DoRaw("HEAD", "/api/latest/fleet/device_ping", nil, http.StatusOK) + s.DoRaw("HEAD", "/api/fleet/device/ping", nil, http.StatusOK) // unauthenticated works too - s.DoRawNoAuth("HEAD", "/api/latest/fleet/device_ping", nil, http.StatusOK) + s.DoRawNoAuth("HEAD", "/api/fleet/device/ping", nil, http.StatusOK) } // this test can be deleted once the "v1" version is removed. diff --git a/server/service/orbit_client.go b/server/service/orbit_client.go index d9bdd664af..ee1767aa46 100644 --- a/server/service/orbit_client.go +++ b/server/service/orbit_client.go @@ -81,7 +81,7 @@ func (oc *OrbitClient) GetConfig(orbitNodeKey string) (json.RawMessage, error) { } func (oc *OrbitClient) Ping() error { - verb, path := "HEAD", "/api/latest/fleet/orbit_ping" + verb, path := "HEAD", "/api/fleet/orbit/ping" err := oc.request(verb, path, nil, nil) if err == nil || errors.Is(err, notFoundErr{}) {