return error on monitorId is null

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pull/163/head
Hyeonwoo Cho 2025-12-07 22:44:20 +09:00 committed by GitHub
parent a18db10e53
commit 3417a22199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -45,6 +45,12 @@ export default async function handler(req: NextRequest): Promise<Response> {
const url = new URL(req.url)
const monitorId = url.searchParams.get('id')
if (!monitorId) {
return new Response(JSON.stringify(errorBadge('UptimeFlare', 'id required')), {
headers: jsonHeaders,
status: 400,
})
}
const label = url.searchParams.get('label') ?? 'UptimeFlare'
const upMsg = url.searchParams.get('up') ?? 'UP'