diff --git a/src/index.test.ts b/src/index.test.ts index a8b85d0..5dcaa00 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -182,20 +182,6 @@ describe('worker fetch handler', () => { astroFetchMock.mockResolvedValue(new Response('OK', { status: 200 })); }); - it('should not cache API endpoints', async () => { - const worker = await getWorker(); - const request = new Request('https://example.com/api/status'); - const envWithPublic = { ...mockEnv, STATUS_PUBLIC: 'true' }; - - const response = await worker.fetch(request, envWithPublic, mockCtx); - - // API endpoint returns JSON, not HTML - expect(response.headers.get('Content-Type')).toBe('application/json'); - expect(response.headers.get('Cache-Control')).toBeNull(); - expect(mockCaches.default.match).not.toHaveBeenCalled(); - expect(mockCaches.default.put).not.toHaveBeenCalled(); - }); - it('should normalize cache key by removing query parameters', async () => { const worker = await getWorker(); const request1 = new Request('https://example.com/?t=1234567890'); diff --git a/src/index.ts b/src/index.ts index 0407de6..29fd863 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,6 @@ import { parseConfig } from './config/index.js'; import { prepareChecks } from './checker/index.js'; import { processResults } from './processor/index.js'; import { formatWebhookPayload } from './alert/index.js'; -import { getStatusApiData } from './api/status.js'; import { getMonitorStates, writeCheckResults, updateMonitorStates, recordAlert } from './db.js'; import { interpolateSecrets } from './utils/interpolate.js'; import type { Env } from './types.js'; @@ -18,24 +17,7 @@ import type { Config } from './config/types.js'; const worker = { async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise { const url = new URL(request.url); - if (url.pathname === '/api/status') { - try { - const configYaml = interpolateSecrets(env.MONITORS_CONFIG, env); - const config = parseConfig(configYaml); - const data = await getStatusApiData(env.DB, config); - return new Response(JSON.stringify(data), { - headers: { 'Content-Type': 'application/json' }, - }); - } catch (error) { - console.error('Status API error:', error); - return new Response(JSON.stringify({ error: 'Internal Server Error' }), { - status: 500, - headers: { 'Content-Type': 'application/json' }, - }); - } - } - // Auth check for all non-API routes const authResponse = await checkAuth(request, env); if (authResponse) { return authResponse;