refactor: improve code formatting and readability across multiple files
This commit is contained in:
parent
c5acc63129
commit
cb8c45456b
1 changed files with 79 additions and 42 deletions
|
|
@ -93,13 +93,17 @@ const getHttpHeaders = (req: express.Request): Record<string, string> => {
|
|||
// Handle multiple custom headers (new approach)
|
||||
if (req.headers["x-custom-auth-headers"] !== undefined) {
|
||||
try {
|
||||
const customHeaderNames = JSON.parse(req.headers["x-custom-auth-headers"] as string) as string[];
|
||||
const customHeaderNames = JSON.parse(
|
||||
req.headers["x-custom-auth-headers"] as string,
|
||||
) as string[];
|
||||
if (Array.isArray(customHeaderNames)) {
|
||||
customHeaderNames.forEach((headerName) => {
|
||||
const lowerCaseHeaderName = headerName.toLowerCase();
|
||||
if (req.headers[lowerCaseHeaderName] !== undefined) {
|
||||
const value = req.headers[lowerCaseHeaderName];
|
||||
headers[headerName] = Array.isArray(value) ? value[value.length - 1] : value;
|
||||
headers[headerName] = Array.isArray(value)
|
||||
? value[value.length - 1]
|
||||
: value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue