fix(HTTP Request Node): Always lowercase headers

This commit is contained in:
Michael Kret
2023-04-27 13:36:02 +03:00
committed by GitHub
parent aa59329836
commit 983e6e124e
3 changed files with 57 additions and 7 deletions

View File

@@ -172,3 +172,11 @@ export const fuzzyCompare = (useFuzzyCompare: boolean, compareVersion = 1) => {
return isEqual(item1, item2);
};
};
export const keysToLowercase = <T>(headers: T) => {
if (typeof headers !== 'object' || Array.isArray(headers) || headers === null) return headers;
return Object.entries(headers).reduce((acc, [key, value]) => {
acc[key.toLowerCase()] = value;
return acc;
}, {} as IDataObject);
};