diff --git a/apps/checker/handlers/checker.go b/apps/checker/handlers/checker.go index 0e14f9e3eb..c0805081b1 100644 --- a/apps/checker/handlers/checker.go +++ b/apps/checker/handlers/checker.go @@ -309,5 +309,12 @@ func (h Handler) HTTPCheckerHandler(c *gin.Context) { } - c.JSON(http.StatusOK, result) + returnData := c.Query("data") + if returnData == "true" { + c.JSON(http.StatusOK, result) + + return + } + + c.JSON(http.StatusOK, nil) } diff --git a/apps/checker/handlers/tcp.go b/apps/checker/handlers/tcp.go index 14f9214cdb..5d32a65250 100644 --- a/apps/checker/handlers/tcp.go +++ b/apps/checker/handlers/tcp.go @@ -210,12 +210,19 @@ func (h Handler) TCPHandler(c *gin.Context) { } } - c.JSON(http.StatusOK, response) + returnData := c.Query("data") + if returnData == "true" { + c.JSON(http.StatusOK, response) + + return + } + + c.JSON(http.StatusOK, nil) } func (h Handler) TCPHandlerRegion(c *gin.Context) { ctx := c.Request.Context() - dataSourceName := "check_tcp_response__v1" + dataSourceName := "check_tcp_respo…nse__v1" region := c.Param("region") if region == "" { diff --git a/apps/server/src/v1/monitors/run/post.ts b/apps/server/src/v1/monitors/run/post.ts index add95e11b4..91926b3544 100644 --- a/apps/server/src/v1/monitors/run/post.ts +++ b/apps/server/src/v1/monitors/run/post.ts @@ -42,7 +42,7 @@ const triggerMonitor = createRoute({ 200: { content: { "application/json": { - schema: z.array(HTTPTriggerResult).or(z.array(TCPTriggerResult)), + schema: z.array(TriggerResult), }, }, description: "All the historical metrics", @@ -218,9 +218,9 @@ export function registerRunMonitor(api: typeof monitorsApi) { function generateUrl({ row }: { row: z.infer }) { switch (row.jobType) { case "http": - return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api`; + return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api&data=true`; case "tcp": - return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api`; + return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api&data=true`; default: throw new Error("Invalid jobType"); } diff --git a/apps/server/src/v1/monitors/trigger/post.ts b/apps/server/src/v1/monitors/trigger/post.ts index b4b12d34f1..f67351e40c 100644 --- a/apps/server/src/v1/monitors/trigger/post.ts +++ b/apps/server/src/v1/monitors/trigger/post.ts @@ -186,9 +186,9 @@ export function registerTriggerMonitor(api: typeof monitorsApi) { function generateUrl({ row }: { row: z.infer }) { switch (row.jobType) { case "http": - return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api`; + return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api&data=true`; case "tcp": - return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api`; + return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api&data=true`; default: throw new Error("Invalid jobType"); }