parent
57dc357e90
commit
20ee325e62
@ -66,7 +66,6 @@ export class TestServer {
|
||||
#csp = new Map<string, string>();
|
||||
#gzipRoutes = new Set<string>();
|
||||
#requestSubscribers = new Map<string, Subscriber>();
|
||||
#requests = new Set<ServerResponse>();
|
||||
|
||||
static async create(dirPath: string): Promise<TestServer> {
|
||||
let res!: (value: unknown) => void;
|
||||
@ -193,20 +192,12 @@ export class TestServer {
|
||||
subscriber.reject.call(undefined, error);
|
||||
}
|
||||
this.#requestSubscribers.clear();
|
||||
for (const request of this.#requests.values()) {
|
||||
if (!request.writableEnded) {
|
||||
request.end();
|
||||
}
|
||||
}
|
||||
this.#requests.clear();
|
||||
}
|
||||
|
||||
#onRequest: RequestListener = (
|
||||
request: TestIncomingMessage,
|
||||
response
|
||||
): void => {
|
||||
this.#requests.add(response);
|
||||
|
||||
request.on('error', (error: {code: string}) => {
|
||||
if (error.code === 'ECONNRESET') {
|
||||
response.end();
|
||||
|
Loading…
Reference in New Issue
Block a user