mirror of
https://github.com/expressjs/express.git
synced 2026-02-21 19:41:36 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user