feat: add support for ETag option in res.sendFile (#6073)

This patch introduces the ability to control the ETag generation
through the `res.sendFile` function. Specifically, the ETag option
is wired to the application's configuration, allowing it to be
enabled or disabled based on the app's settings.

Fixes: https://github.com/expressjs/express/issues/2294

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
Juan José
2025-02-13 14:39:31 -05:00
committed by GitHub
parent d2de128a32
commit 327af123a1
3 changed files with 17 additions and 0 deletions

View File

@@ -389,6 +389,9 @@ res.sendFile = function sendFile(path, options, callback) {
// create file stream
var pathname = encodeURI(path);
// wire application etag option to send
opts.etag = this.app.enabled('etag');
var file = send(req, pathname, opts);
// transfer