mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-25 02:48:23 +01:00
makeHttpError: Ensure response headers have lowercase names
This commit is contained in:
@@ -638,12 +638,25 @@ function makeHTTPError(
|
||||
) {
|
||||
return new HTTPError(message, {
|
||||
code: providedCode,
|
||||
headers,
|
||||
headers: makeKeysLowercase(headers),
|
||||
response,
|
||||
stack,
|
||||
});
|
||||
}
|
||||
|
||||
export function makeKeysLowercase<V>(
|
||||
headers: Record<string, V>
|
||||
): Record<string, V> {
|
||||
const keys = Object.keys(headers);
|
||||
const lowerCase: Record<string, V> = Object.create(null);
|
||||
|
||||
keys.forEach(key => {
|
||||
lowerCase[key.toLowerCase()] = headers[key];
|
||||
});
|
||||
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
const URL_CALLS = {
|
||||
accountExistence: 'v1/accounts/account',
|
||||
attachmentUploadForm: 'v4/attachments/form/upload',
|
||||
|
||||
Reference in New Issue
Block a user