Skip to content

Force compression to client don't work #83

Description

@zhaoyou

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.

Activity

  1. zhaoyou commented on May 20, 2016

    @zhaoyou
    Author
  2. dougwilson commented on May 20, 2016

    @dougwilson
    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()
    }
  3. self-assigned this
    on May 20, 2016
  4. zhaoyou commented on May 20, 2016

    @zhaoyou
    Author

    @dougwilson Thanks 👍 for your explanation and suggestion.

  5. bjohansebas commented on Sep 20, 2024

    @bjohansebas
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions