diff --git a/src/main.go b/src/main.go index 69672a4..92e1a7c 100644 --- a/src/main.go +++ b/src/main.go @@ -49,7 +49,7 @@ func init() { app.Use(cors.New(cors.Config{ AllowOrigins: "*", AllowMethods: "HEAD,OPTIONS,GET", - ExposeHeaders: "X-Cache-Time-Remaining", + ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining", })) app.Use(logger.New(logger.Config{ diff --git a/src/routes.go b/src/routes.go index 3cd34ac..70c0233 100644 --- a/src/routes.go +++ b/src/routes.go @@ -38,6 +38,8 @@ func JavaStatusHandler(ctx *fiber.Ctx) error { return err } + ctx.Set("X-Cache-Hit", strconv.FormatBool(expiresAt != nil)) + if expiresAt != nil { ctx.Set("X-Cache-Time-Remaining", strconv.Itoa(int(expiresAt.Seconds()))) } @@ -62,6 +64,8 @@ func BedrockStatusHandler(ctx *fiber.Ctx) error { return err } + ctx.Set("X-Cache-Hit", strconv.FormatBool(expiresAt != nil)) + if expiresAt != nil { ctx.Set("X-Cache-Time-Remaining", strconv.Itoa(int(expiresAt.Seconds()))) } @@ -82,6 +86,8 @@ func IconHandler(ctx *fiber.Ctx) error { return err } + ctx.Set("X-Cache-Hit", strconv.FormatBool(expiresAt != nil)) + if expiresAt != nil { ctx.Set("X-Cache-Time-Remaining", strconv.Itoa(int(expiresAt.Seconds()))) }