diff --git a/pkg/api/bridge.go b/pkg/api/bridge.go index b5291eb09d6f115ed1115a9403067f89ad9b3ed5..1c3f030289bd9d7a31d11389ac4cd1937a86b966 100644 --- a/pkg/api/bridge.go +++ b/pkg/api/bridge.go @@ -26,6 +26,10 @@ import ( // @Router /api/5/bridges [get] // @Security BucketTokenAuth func (r *registry) ListAllBridges(c echo.Context) error { + + // Set Cache-Control header to instruct clients not to cache response + c.Response().Header().Set("Cache-Control", "no-store") + // Step 1: Validate parameters cc, err := sanitizeCountryCode(c.QueryParam(paramCountryCode)) if err != nil { @@ -63,10 +67,10 @@ func (r *registry) ListAllBridges(c echo.Context) error { // Step 4: sort gateways result, err := sortEndpoints(cc, availableBridges, r.locations, r.lm) - if err != nil { return c.JSON(http.StatusBadRequest, err) } + return c.JSON(http.StatusOK, result) } diff --git a/pkg/api/gateway.go b/pkg/api/gateway.go index 15a3a4b84285ed29ca5d5fb940f8ab732ded6628..8454dee5e29b7a6bfa5bd9cea299d16f278705ff 100644 --- a/pkg/api/gateway.go +++ b/pkg/api/gateway.go @@ -32,6 +32,10 @@ var ( // @Router /api/5/gateways [get] // @Security BucketTokenAuth func (r *registry) ListAllGateways(c echo.Context) error { + + // Set Cache-Control header to instruct clients not to cache response + c.Response().Header().Set("Cache-Control", "no-store") + // Step 1: Validate parameters cc, err := sanitizeCountryCode(c.QueryParam(paramCountryCode)) if err != nil { @@ -68,10 +72,10 @@ func (r *registry) ListAllGateways(c echo.Context) error { // Step 4: sort gateways result, err := sortEndpoints(cc, availableGateways, r.locations, r.lm) - if err != nil { return c.JSON(http.StatusBadRequest, nil) } + return c.JSON(http.StatusOK, result) }