Skip to content

Commit 1d5572d

Browse files
authored
test: answer favicon requests in the test server with 204 (#43772)
1 parent f540a62 commit 1d5572d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎tests/config/testserver/index.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,15 @@ export class TestServer {
260260
this._requestSubscribers.delete(pathWithSearch);
261261
}
262262
const handler = this._routes.get(pathWithSearch);
263-
if (handler)
263+
if (handler) {
264264
handler.call(null, request as IncomingMessageWithBody, response);
265-
else
265+
} else if (pathWithSearch === '/favicon.ico') {
266+
// Headless Chrome requests the favicon after a load and logs a 404 to the console of the page.
267+
response.statusCode = 204;
268+
response.end();
269+
} else {
266270
this.serveFile(request, response);
271+
}
267272
}
268273

269274
serveFile(request: http.IncomingMessage, response: http.ServerResponse, filePath?: string): void {

0 commit comments

Comments
 (0)