Files
lislgosms/api/src/http-server-timeouts.spec.ts
T

21 lines
867 B
TypeScript

import { configureApiHttpServerTimeouts } from './http-server-timeouts';
describe('configureApiHttpServerTimeouts', () => {
it('keeps the API connection alive longer than the Gateway idle pool', () => {
const server = { keepAliveTimeout: 0, headersTimeout: 0 };
expect(configureApiHttpServerTimeouts(server, {})).toEqual({
keepAliveTimeoutMs: 120_000,
headersTimeoutMs: 125_000,
});
expect(server).toEqual({ keepAliveTimeout: 120_000, headersTimeout: 125_000 });
});
it('keeps headers timeout above a configured keep-alive timeout', () => {
const server = { keepAliveTimeout: 0, headersTimeout: 0 };
expect(configureApiHttpServerTimeouts(server, {
API_HTTP_KEEP_ALIVE_TIMEOUT_MS: '90000',
API_HTTP_HEADERS_TIMEOUT_MS: '1000',
})).toEqual({ keepAliveTimeoutMs: 90_000, headersTimeoutMs: 91_000 });
});
});