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

How to add headers #117

Open
arifmahmudrana opened this issue May 18, 2019 · 0 comments
Open

How to add headers #117

arifmahmudrana opened this issue May 18, 2019 · 0 comments

Comments

@arifmahmudrana
Copy link

Hi
Thanks for your awesome package. I have below code

router.get(
  '/:id([a-f0-9]{24})',
  (req, res, next) => {
    // set cache name
    res.express_redis_cache_name = 'task-' + req.params.id;
    next();
  },
  cache.route({
    expire: {
      200: 3600,
      xxx: 0
    }
  }),
  taskMiddlewares.findByIdWithUser,
  (req, res) => {
    res
      .set({
        'Cache-Control': 'private, must-revalidate',
        'Last-Modified': req.task.updatedAt.toUTCString()
      })
      .json(taskTransformer(req.task));
  }
);

But when the cache responses it doesn't add the Cache-Control & Last-Modified headers as I see your code I didn't find any workaround any suggestion or do you have any plans to add headers rather saving parts like content type.

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

No branches or pull requests

1 participant