expressjs / expressjs/express

custom ETag function isn't working for SendFile

Open
#4,750 3 comments 0 reactions 0 assignees View on GitHub
awaiting more info
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

I set the custom function according to the http://expressjs.com/en/api.html#etag.options.table
```
app.set('etag', function (body, encoding) {
return generateHash(body, encoding) // consider the function is defined
})
```
Despite on that it's not working and the best way I could influence etag value is to call
sendFile with etag : true or false but this just turns on and off the standard etag (also not documented) , not the custom one.

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

My use case is that I want to track responses of specific files. So I wanted to make a "strong hash" that I can be 100% sure would unambiguously represent the file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.