Files
boc/vims-backend/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

30 lines
985 B
JavaScript

import { escapeUri } from "@smithy/core/protocols";
import { SIGNATURE_HEADER } from "./constants";
export const getCanonicalQuery = ({ query = {} }) => {
const keys = [];
const serialized = {};
for (const key of Object.keys(query)) {
if (key.toLowerCase() === SIGNATURE_HEADER) {
continue;
}
const encodedKey = escapeUri(key);
keys.push(encodedKey);
const value = query[key];
if (typeof value === "string") {
serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
}
else if (Array.isArray(value)) {
serialized[encodedKey] = value
.slice(0)
.reduce((encoded, value) => encoded.concat([`${encodedKey}=${escapeUri(value)}`]), [])
.sort()
.join("&");
}
}
return keys
.sort()
.map((key) => serialized[key])
.filter((serialized) => serialized)
.join("&");
};