fastify / fastify-compress

Fastify compression utils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicated accept-encoding vary header in response

marcoreni opened this issue Β· comments

πŸ› Bug Report

If the vary header has already been set as a string with multiple concatenated values, one of which is "accept-encoding", the plugin adds a second vary header with the "accept-encoding" value.

To Reproduce

Steps to reproduce the behavior:

1- register the plugin, then set the following into a route

reply.header('vary', 'accept-encoding,accept-version');

2- Check the response

Expected behavior

The value should not be added if already set inside the vary header.

NOTE: the plugin works correctly if the vary header is set as an array, ie. reply.header('vary', ['accept-encoding','accept-version']);, but I think the string version should also be handled.

Your Environment

  • node version: 14.15.1
  • fastify version: 3.12.0
  • os: Mac

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

Will do!