fix duplicate header warning (#56491)

logged when attaching 2+ headers due to excessive check

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Mikhail Shustov 2020-02-03 13:33:19 +01:00 committed by GitHub
parent 3d96e4c95b
commit 598968f20f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -721,6 +721,7 @@ describe('Auth', () => {
res.ok({
headers: {
'www-authenticate': 'from handler',
'another-header': 'yet another header',
},
})
);

View file

@ -120,8 +120,8 @@ export function adoptToHapiOnPreResponseFormat(fn: OnPreResponseHandler, log: Lo
...(result.headers as any), // hapi types don't specify string[] as valid value
};
} else {
findHeadersIntersection(response.headers, result.headers, log);
for (const [headerName, headerValue] of Object.entries(result.headers)) {
findHeadersIntersection(response.headers, result.headers, log);
response.header(headerName, headerValue as any); // hapi types don't specify string[] as valid value
}
}