Force lowercase in all headers (#1187)

This commit is contained in:
Tomas Della Vedova
2020-05-14 16:10:18 +02:00
committed by GitHub
parent 22de806b67
commit 191b8fb9fb
4 changed files with 105 additions and 22 deletions

View File

@ -2416,3 +2416,32 @@ test('Secure json parsing', t => {
t.end()
})
test('Lowercase headers utilty', t => {
t.plan(4)
const { lowerCaseHeaders } = Transport.internals
t.deepEqual(lowerCaseHeaders({
Foo: 'bar',
Faz: 'baz',
'X-Hello': 'world'
}), {
foo: 'bar',
faz: 'baz',
'x-hello': 'world'
})
t.deepEqual(lowerCaseHeaders({
Foo: 'bar',
faz: 'baz',
'X-hello': 'world'
}), {
foo: 'bar',
faz: 'baz',
'x-hello': 'world'
})
t.strictEqual(lowerCaseHeaders(null), null)
t.strictEqual(lowerCaseHeaders(undefined), undefined)
})