FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Replace accepts with negotiator by blakeembrey · Pull Request #197 · expressjs/compression · GitHub

Replace accepts with negotiator - #197

Merged
bjohansebas merged 1 commit into
masterfrom
be/use-negotiator
Oct 25, 2024
Merged

Replace accepts with negotiator#197
bjohansebas merged 1 commit into
masterfrom
be/use-negotiator

Conversation

blakeembrey commented Oct 24, 2024
edited
Loading

Copy link
Copy Markdown
Member

Follow up to #194 (comment).

Comment thread index.js
method = accept.encoding(['gzip', 'identity'])
}
var negotiator = new Negotiator(req)
var method = negotiator.encoding(['gzip', 'deflate', 'identity'], ['gzip'])

blakeembrey Oct 24, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

When you add brotli, just add it here:

Suggested change
var method = negotiator.encoding(['gzip', 'deflate', 'identity'], ['gzip'])
var method = negotiator.encoding(hasBrotli ? ['br', 'gzip', 'deflate', 'identity'] : ['gzip', 'deflate', 'identity'], hasBrotli ? ['br', 'gzip'] : ['gzip'])

Edit: Could be better to store in global vars, e.g.

var SUPPORTED_ENCODING = hasBrotli ? ['br', 'gzip', 'deflate', 'identity'] : ['gzip', 'deflate', 'identity']; 
var PREFERRED_ENCODING = hasBrotli ? ['br', 'gzip'] : ['gzip'];

bjohansebas merged commit d3560e0 into master Oct 25, 2024
blakeembrey deleted the be/use-negotiator branch October 25, 2024 21:26
jonchurch mentioned this pull request Oct 26, 2024
UlisesGascon mentioned this pull request Oct 29, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL