27 lines
843 B
JavaScript
27 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];
|
||
|
}
|
||
|
}
|
||
|
};
|