K6 is not sending all headers

I send 2 headers with same name like
const headers = {
headers: {
‘Authorization’: Bearer ${data[0]},
‘Content-Type’: ‘application/io.proof-v2+json’,
‘x-proof-properties’: ‘key=value’,
‘x-proof-properties’: ‘key2=value2’,

When I ran my script, I got 400 error “unable to process json”. Then I ran the same script with --http-debug=“full” and I saw that ‘x-proof-properties’: ‘key=value’ header was missing from request. Does K6 support header config like that?

Unfortunately no, sorry. The problem is that headers are specified as a JavaScript object, and you can’t have two different elements with the same key in them. So, with the current k6 JS HTTP API, the first header never reaches the Go code that makes the request…

That said, if your webserver and backend follow the HTTP RFC, this shouldn’t matter, since your example should be equivalent to sending a single x-proof-properties header with the value of key=value,key2=value2.

See HTTP Header Key can be repeated? - Stack Overflow and RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing :

A sender MUST NOT generate multiple header fields with the same field name in a message unless either the entire field value for that header field is defined as a comma-separated list [i.e., #(values)] or the header field is a well-known exception (as noted below).