light-my-request
light-my-request copied to clipboard
Multi-value request headers are serialized to comma-separated string
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.23.2
Plugin version
No response
Node.js version
20.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.0
Description
The .inject()
method allows to inject request headers which values can be a string or an array of strings. When an array is used, it gets serialized to an comma-separated string.
Steps to Reproduce
await fastifyInstance.inject({ method: 'get', url: '/', headers: { foo: 'bar', baz: ['first', 'second'] } });
gives me the following request headers in the route handler:
{
baz: 'first,second',
foo: 'bar',
host: 'localhost:80',
'user-agent': 'lightMyRequest'
}
Expected Behavior
I would expect to get an array of strings in the route handler as well.