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/cloneRequest.js
2024-05-26 22:54:55 +02:00

12 lines
393 B
JavaScript

export const cloneRequest = ({ headers, query, ...rest }) => ({
...rest,
headers: { ...headers },
query: query ? cloneQuery(query) : undefined,
});
export const cloneQuery = (query) => Object.keys(query).reduce((carry, paramName) => {
const param = query[paramName];
return {
...carry,
[paramName]: Array.isArray(param) ? [...param] : param,
};
}, {});