So, in that bit of code, if you do setHeader('x-FoO', 'baR'), then:
this._headers['x-foo'] === 'baR'
this._headerNames['x-foo'] === 'x-FoO'
Later, when it actually writes the header lines, it writes:
this._headerNames['x-foo'] + ': ' + this._headers['x-foo'] + '\r\n'
or in other words:
'x-FoO: baR\r\n'
just like you asked it to.
This code is about the outgoing headers that *your app* sends out.
(Ie, the HTTP response in a Server, or the HTTP request in a Client.)
Without theories about *why* it is, can you you clarify what you're
actually having problems with?
1. My node http server is sending lowercased headers in the response.
2. My node http server is receiving lowercased headers in the request.
3. My node http client is sending lowercased headers in the request.
4. My node http client is receiving lowercased headers in the response.