diff --git a/server/service/devices.go b/server/service/devices.go index d1cc429641..c950fe8f69 100644 --- a/server/service/devices.go +++ b/server/service/devices.go @@ -46,6 +46,8 @@ type fleetDesktopResponse struct { FailingPolicies *uint `json:"failing_policies_count,omitempty"` } +func (r fleetDesktopResponse) error() error { return r.Err } + type getFleetDesktopRequest struct { Token string `url:"token"` } diff --git a/server/service/integration_desktop_test.go b/server/service/integration_desktop_test.go index 8293a6367c..4be1427033 100644 --- a/server/service/integration_desktop_test.go +++ b/server/service/integration_desktop_test.go @@ -135,6 +135,13 @@ func (s *integrationTestSuite) TestDeviceAuthenticatedEndpoints() { json.NewDecoder(res.Body).Decode(&getHostResp) res.Body.Close() require.Nil(t, listPoliciesResp.Policies) + + // /device/desktop is not accessible for free endpoints + getDesktopResp := fleetDesktopResponse{} + res = s.DoRawNoAuth("GET", "/api/latest/fleet/device/"+token+"/desktop", nil, http.StatusPaymentRequired) + json.NewDecoder(res.Body).Decode(&getDesktopResp) + res.Body.Close() + require.Nil(t, getDesktopResp.FailingPolicies) } // TestDefaultTransparencyURL tests that Fleet Free licensees are restricted to the default transparency url.