This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs-blog-newsletter/cronjob/node_modules/@smithy/signature-v4/dist-es/headerUtil.js
2024-05-26 22:54:55 +02:00

26 lines
843 B
JavaScript

export const hasHeader = (soughtHeader, headers) => {
soughtHeader = soughtHeader.toLowerCase();
for (const headerName of Object.keys(headers)) {
if (soughtHeader === headerName.toLowerCase()) {
return true;
}
}
return false;
};
export const getHeaderValue = (soughtHeader, headers) => {
soughtHeader = soughtHeader.toLowerCase();
for (const headerName of Object.keys(headers)) {
if (soughtHeader === headerName.toLowerCase()) {
return headers[headerName];
}
}
return undefined;
};
export const deleteHeader = (soughtHeader, headers) => {
soughtHeader = soughtHeader.toLowerCase();
for (const headerName of Object.keys(headers)) {
if (soughtHeader === headerName.toLowerCase()) {
delete headers[headerName];
}
}
};