@aws-sdk/middleware-flexible-checksums 3.714.0 → 3.715.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js
CHANGED
|
@@ -169,6 +169,17 @@ var hasHeader = /* @__PURE__ */ __name((header, headers) => {
|
|
|
169
169
|
return false;
|
|
170
170
|
}, "hasHeader");
|
|
171
171
|
|
|
172
|
+
// src/hasHeaderWithPrefix.ts
|
|
173
|
+
var hasHeaderWithPrefix = /* @__PURE__ */ __name((headerPrefix, headers) => {
|
|
174
|
+
const soughtHeaderPrefix = headerPrefix.toLowerCase();
|
|
175
|
+
for (const headerName of Object.keys(headers)) {
|
|
176
|
+
if (headerName.toLowerCase().startsWith(soughtHeaderPrefix)) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}, "hasHeaderWithPrefix");
|
|
182
|
+
|
|
172
183
|
// src/isStreaming.ts
|
|
173
184
|
var import_is_array_buffer = require("@smithy/is-array-buffer");
|
|
174
185
|
var isStreaming = /* @__PURE__ */ __name((body) => body !== void 0 && typeof body !== "string" && !ArrayBuffer.isView(body) && !(0, import_is_array_buffer.isArrayBuffer)(body), "isStreaming");
|
|
@@ -212,6 +223,9 @@ var flexibleChecksumsMiddleware = /* @__PURE__ */ __name((config, middlewareConf
|
|
|
212
223
|
if (!import_protocol_http.HttpRequest.isInstance(args.request)) {
|
|
213
224
|
return next(args);
|
|
214
225
|
}
|
|
226
|
+
if (hasHeaderWithPrefix("x-amz-checksum-", args.request.headers)) {
|
|
227
|
+
return next(args);
|
|
228
|
+
}
|
|
215
229
|
const { request, input } = args;
|
|
216
230
|
const { body: requestBody, headers } = request;
|
|
217
231
|
const { base64Encoder, streamHasher } = config;
|
|
@@ -4,6 +4,7 @@ import { ChecksumAlgorithm } from "./constants";
|
|
|
4
4
|
import { getChecksumAlgorithmForRequest } from "./getChecksumAlgorithmForRequest";
|
|
5
5
|
import { getChecksumLocationName } from "./getChecksumLocationName";
|
|
6
6
|
import { hasHeader } from "./hasHeader";
|
|
7
|
+
import { hasHeaderWithPrefix } from "./hasHeaderWithPrefix";
|
|
7
8
|
import { isStreaming } from "./isStreaming";
|
|
8
9
|
import { selectChecksumAlgorithmFunction } from "./selectChecksumAlgorithmFunction";
|
|
9
10
|
import { stringHasher } from "./stringHasher";
|
|
@@ -17,6 +18,9 @@ export const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next,
|
|
|
17
18
|
if (!HttpRequest.isInstance(args.request)) {
|
|
18
19
|
return next(args);
|
|
19
20
|
}
|
|
21
|
+
if (hasHeaderWithPrefix("x-amz-checksum-", args.request.headers)) {
|
|
22
|
+
return next(args);
|
|
23
|
+
}
|
|
20
24
|
const { request, input } = args;
|
|
21
25
|
const { body: requestBody, headers } = request;
|
|
22
26
|
const { base64Encoder, streamHasher } = config;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const hasHeaderWithPrefix = (headerPrefix, headers) => {
|
|
2
|
+
const soughtHeaderPrefix = headerPrefix.toLowerCase();
|
|
3
|
+
for (const headerName of Object.keys(headers)) {
|
|
4
|
+
if (headerName.toLowerCase().startsWith(soughtHeaderPrefix)) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-flexible-checksums",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.715.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-flexible-checksums",
|