mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-08-31 01:01:11 +08:00
fix(core): healthz bypass cache (#16455)
This commit is contained in:
@@ -29,4 +29,12 @@ describe('registry', () => {
|
||||
const response = await app.request('/favicon.ico');
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
// healthz
|
||||
it('/healthz', async () => {
|
||||
const response = await app.request('/healthz');
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get('cache-control')).toBe('no-cache');
|
||||
expect(await response.text()).toBe('ok');
|
||||
});
|
||||
});
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import { serveStatic } from '@hono/node-server/serve-static';
|
||||
import { config } from '@/config';
|
||||
|
||||
import index from '@/routes/index';
|
||||
import healthz from '@/routes/healthz';
|
||||
import robotstxt from '@/routes/robots.txt';
|
||||
import metrics from '@/routes/metrics';
|
||||
|
||||
@@ -100,7 +101,7 @@ for (const namespace in namespaces) {
|
||||
}
|
||||
|
||||
app.get('/', index);
|
||||
app.get('/healthz', (ctx) => ctx.text('ok'));
|
||||
app.get('/healthz', healthz);
|
||||
app.get('/robots.txt', robotstxt);
|
||||
if (config.debugInfo) {
|
||||
// Only enable tracing in debug mode
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { Handler } from 'hono';
|
||||
|
||||
const handler: Handler = (ctx) => {
|
||||
ctx.header('Cache-Control', 'no-cache');
|
||||
return ctx.text('ok');
|
||||
};
|
||||
|
||||
export default handler;
|
||||
Reference in New Issue
Block a user