Skip to content

How to add headers #117

@arifmahmudrana

Description

@arifmahmudrana

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions