[Backport 7.x] Force lowercase in all headers (#1195)

This commit is contained in:
github-actions[bot]
2020-05-14 16:11:12 +02:00
committed by GitHub
parent 11951fe8fc
commit 15a9479a81
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)
})