chore(repo): prune dead code and duplicate abstractions (#3413)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-12 13:09:42 +02:00
1 parent c17091768c
commit c9fdf8fead
2937 files changed
+42233 -176793

No files matched your search

+10 -1
View File
@@ -45,20 +45,29 @@ describe('Server limits', () => {
expect(httpServer.requestTimeout).toBe(120_000);
expect(httpServer.keepAliveTimeout).toBe(125_000);
expect(httpServer.maxRequestsPerSocket).toBe(1_000);
expect(httpServer.headersTimeout).toBeLessThanOrEqual(httpServer.requestTimeout);
expect(httpServer.headersTimeout).toBe(30_000);
});
test('honours explicit limit overrides', async () => {
const listening = await listen({
port: 0,
requestTimeoutMs: 15_000,
headersTimeoutMs: 10_000,
keepAliveTimeoutMs: 61_000,
maxRequestsPerSocket: 250,
});
server = listening.server;
const httpServer = server as Server;
expect(httpServer.requestTimeout).toBe(15_000);
expect(httpServer.headersTimeout).toBe(10_000);
expect(httpServer.keepAliveTimeout).toBe(61_000);
expect(httpServer.maxRequestsPerSocket).toBe(250);
});
test('clamps the header timeout to the request timeout', async () => {
const listening = await listen({port: 0, requestTimeoutMs: 5_000});
server = listening.server;
const httpServer = server as Server;
expect(httpServer.headersTimeout).toBe(5_000);
});
});
@@ -1,44 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {createServer} from '@fluxer/hono/src/Server';
import {Hono} from 'hono';
import {afterEach, describe, expect, it} from 'vitest';
const servers: Array<{close: (cb: () => void) => void}> = [];
afterEach(async () => {
await Promise.all(servers.splice(0).map((s) => new Promise<void>((r) => s.close(() => r()))));
});
function listen(options: Parameters<typeof createServer>[1]) {
const app = new Hono();
app.post('/echo', async (ctx) => ctx.text(String((await ctx.req.text()).length)));
const server = createServer(app, options) as never as {
close: (cb: () => void) => void;
address: () => {port: number};
headersTimeout: number;
requestTimeout: number;
};
servers.push(server);
return server;
}
describe('createServer timeouts', () => {
it('separates the header timeout from the total request timeout', () => {
const server = listen({port: 0});
expect(server.headersTimeout).toBe(30_000);
expect(server.requestTimeout).toBe(120_000);
});
it('lets both be overridden', () => {
const server = listen({port: 0, headersTimeoutMs: 1_000, requestTimeoutMs: 2_000});
expect(server.headersTimeout).toBe(1_000);
expect(server.requestTimeout).toBe(2_000);
});
it('never lets the header timeout exceed the request timeout', () => {
const server = listen({port: 0, requestTimeoutMs: 5_000});
expect(server.requestTimeout).toBe(5_000);
expect(server.headersTimeout).toBeLessThanOrEqual(server.requestTimeout);
});
});