chore: enable keepAlive in happy eyeballs http.Agent (#31434)

This commit is contained in:
Max Schmitt 2024-06-25 19:05:32 +02:00 committed by GitHub
parent a6b6b243d0
commit f11ab2f145
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -45,8 +45,9 @@ class HttpsHappyEyeballsAgent extends https.Agent {
} }
} }
export const httpsHappyEyeballsAgent = new HttpsHappyEyeballsAgent(); // These options are aligned with the default Node.js globalAgent options.
export const httpHappyEyeballsAgent = new HttpHappyEyeballsAgent(); export const httpsHappyEyeballsAgent = new HttpsHappyEyeballsAgent({ keepAlive: true });
export const httpHappyEyeballsAgent = new HttpHappyEyeballsAgent({ keepAlive: true });
export async function createSocket(host: string, port: number): Promise<net.Socket> { export async function createSocket(host: string, port: number): Promise<net.Socket> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View file

@ -853,7 +853,7 @@ it('should not hang on a brotli encoded Range request', async ({ context, server
headers: { headers: {
range: 'bytes=0-2', range: 'bytes=0-2',
}, },
})).rejects.toThrow(/(failed to decompress 'br' encoding: Error: unexpected end of file|Parse Error: Data after \`Connection: close\`)/); })).rejects.toThrow(/Parse Error: Expected HTTP/);
}); });
it('should dispose', async function({ context, server }) { it('should dispose', async function({ context, server }) {