UNPKG

808 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.moveHeadersToQuery = void 0;
4const cloneRequest_1 = require("./cloneRequest");
5const moveHeadersToQuery = (request, options = {}) => {
6 var _a;
7 const { headers, query = {} } = typeof request.clone === "function" ? request.clone() : (0, cloneRequest_1.cloneRequest)(request);
8 for (const name of Object.keys(headers)) {
9 const lname = name.toLowerCase();
10 if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) === null || _a === void 0 ? void 0 : _a.has(lname))) {
11 query[name] = headers[name];
12 delete headers[name];
13 }
14 }
15 return {
16 ...request,
17 headers,
18 query,
19 };
20};
21exports.moveHeadersToQuery = moveHeadersToQuery;