Skip to content

[Feature Request]: Support Strong Etag Generation #264

@samuel871211

Description

@samuel871211

Problem

Currently, send always generates weak ETags for file stats. Some use cases require strong ETags for better HTTP caching semantics.

Proposed Solution

Add an option to generate strong ETags based on file stats:

send(req, path, { 
  etag: { weak: false }  // strong ETag
})

We can modify the source code as below

var val = etag(stat, { weak: this._etag.weak })
...

Implementation preserves backward compatibility

etag: true → continues to generate weak ETags (unchanged)
etag: { weak: false } → generates strong ETags
etag: { weak: true } → generates weak ETags
etag: false → disables ETag generation (unchanged)

Would you be interested in this enhancement? I'm happy to contribute to the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions