Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force compression to client don't work #83

Open
zhaoyou opened this issue May 18, 2016 · 4 comments · May be fixed by #191
Open

Force compression to client don't work #83

zhaoyou opened this issue May 18, 2016 · 4 comments · May be fixed by #191
Assignees

Comments

@zhaoyou
Copy link

zhaoyou commented May 18, 2016

I want compression response body to client always , Whether the client have any Settings。My Client App is poor what can't set any request header, but can handle compression data.

app.get('/device', auth_identity, compression({filter: function(req, res) { return true;}}),device);
node: v4.2.2
compression: 1.6.1
express : 3.4.4

Why ? thanks.

@zhaoyou
Copy link
Author

zhaoyou commented May 20, 2016

@dougwilson

@dougwilson
Copy link
Contributor

Hi @zhaoyou, sorry I haven't gotten back to you yet. Yes, this is a hole in the module currently, that you cannot override the way the module checks if the client is capable of receiving compressed content, and I think it would be good to add it.

In the meantime, I would like the offer the following work-around for your use-case:

app.get('/device', auth_identity, always_compress, compression(), device)

function always_compress (req, res, next) {
  req.headers['accept-encoding'] = 'gzip'
  next()
}

@dougwilson dougwilson self-assigned this May 20, 2016
@zhaoyou
Copy link
Author

zhaoyou commented May 20, 2016

@dougwilson Thanks 👍 for your explanation and suggestion.

@bjohansebas
Copy link
Member

Allowing the option to choose a default encoder can solve this issue.

@bjohansebas bjohansebas linked a pull request Sep 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants