@smithy/middleware-apply-body-checksum 4.3.14 → 4.4.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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var protocols = require('@smithy/core/protocols');
|
|
4
|
+
var serde = require('@smithy/core/serde');
|
|
5
5
|
|
|
6
6
|
const applyMd5BodyChecksumMiddleware = (options) => (next) => async (args) => {
|
|
7
7
|
const { request } = args;
|
|
8
|
-
if (
|
|
8
|
+
if (protocols.HttpRequest.isInstance(request)) {
|
|
9
9
|
const { body, headers } = request;
|
|
10
10
|
if (!hasHeader("content-md5", headers)) {
|
|
11
11
|
let digest;
|
|
12
|
-
if (body === undefined || typeof body === "string" || ArrayBuffer.isView(body) ||
|
|
12
|
+
if (body === undefined || typeof body === "string" || ArrayBuffer.isView(body) || serde.isArrayBuffer(body)) {
|
|
13
13
|
const hash = new options.md5();
|
|
14
14
|
hash.update(body || "");
|
|
15
15
|
digest = hash.digest();
|
|
@@ -17,7 +17,7 @@ const applyMd5BodyChecksumMiddleware = (options) => (next) => async (args) => {
|
|
|
17
17
|
else {
|
|
18
18
|
digest = options.streamHasher(options.md5, body);
|
|
19
19
|
}
|
|
20
|
-
const cloned =
|
|
20
|
+
const cloned = protocols.HttpRequest.clone(request);
|
|
21
21
|
cloned.headers = {
|
|
22
22
|
...headers,
|
|
23
23
|
"content-md5": options.base64Encoder(await digest),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
2
|
+
import { isArrayBuffer } from "@smithy/core/serde";
|
|
3
3
|
export const applyMd5BodyChecksumMiddleware = (options) => (next) => async (args) => {
|
|
4
4
|
const { request } = args;
|
|
5
5
|
if (HttpRequest.isInstance(request)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/middleware-apply-body-checksum",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
6
6
|
"build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline middleware-apply-body-checksum",
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@smithy/
|
|
29
|
-
"@smithy/protocol-http": "^5.3.14",
|
|
28
|
+
"@smithy/core": "^3.24.0",
|
|
30
29
|
"@smithy/types": "^4.14.1",
|
|
31
30
|
"tslib": "^2.6.2"
|
|
32
31
|
},
|