fix: Fix Headers parsing (#176)

This commit is contained in:
Shorpo 2024-01-02 19:24:57 -07:00 committed by GitHub
parent ea20a79825
commit 807736c7aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@hyperdx/app': patch
---
Fix Headers parsing in Log Details

View file

@ -929,7 +929,16 @@ const parseHeaders = (
const reqHeaderObj: Dictionary<string | string[] | Dictionary<string>> =
pickBy(parsedProperties, (value, key) => key.startsWith(keyPrefix));
return Object.entries(reqHeaderObj).flatMap(([fullKey, value]) => {
return Object.entries(reqHeaderObj).flatMap(([fullKey, _value]) => {
let value = _value;
try {
if (typeof _value === 'string') {
value = JSON.parse(_value);
}
} catch (e) {
// ignore
}
// Replacing _ -> - is part of the otel spec, idk why
const key = fullKey.replace(keyPrefix, '').replace('_', '-');