@smithy/middleware-apply-body-checksum 3.0.4 → 3.0.5

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
@@ -31,7 +31,7 @@ module.exports = __toCommonJS(src_exports);
31
31
  var import_is_array_buffer = require("@smithy/is-array-buffer");
32
32
  var import_protocol_http = require("@smithy/protocol-http");
33
33
  var applyMd5BodyChecksumMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => {
34
- let { request } = args;
34
+ const { request } = args;
35
35
  if (import_protocol_http.HttpRequest.isInstance(request)) {
36
36
  const { body, headers } = request;
37
37
  if (!hasHeader("content-md5", headers)) {
@@ -43,19 +43,18 @@ var applyMd5BodyChecksumMiddleware = /* @__PURE__ */ __name((options) => (next)
43
43
  } else {
44
44
  digest = options.streamHasher(options.md5, body);
45
45
  }
46
- request = {
47
- ...request,
48
- headers: {
49
- ...headers,
50
- "content-md5": options.base64Encoder(await digest)
51
- }
46
+ const cloned = import_protocol_http.HttpRequest.clone(request);
47
+ cloned.headers = {
48
+ ...headers,
49
+ "content-md5": options.base64Encoder(await digest)
52
50
  };
51
+ return next({
52
+ ...args,
53
+ request: cloned
54
+ });
53
55
  }
54
56
  }
55
- return next({
56
- ...args,
57
- request
58
- });
57
+ return next(args);
59
58
  }, "applyMd5BodyChecksumMiddleware");
60
59
  var applyMd5BodyChecksumMiddlewareOptions = {
61
60
  name: "applyMd5BodyChecksumMiddleware",
@@ -1,7 +1,7 @@
1
1
  import { isArrayBuffer } from "@smithy/is-array-buffer";
2
2
  import { HttpRequest } from "@smithy/protocol-http";
3
3
  export const applyMd5BodyChecksumMiddleware = (options) => (next) => async (args) => {
4
- let { request } = args;
4
+ const { request } = args;
5
5
  if (HttpRequest.isInstance(request)) {
6
6
  const { body, headers } = request;
7
7
  if (!hasHeader("content-md5", headers)) {
@@ -14,19 +14,18 @@ export const applyMd5BodyChecksumMiddleware = (options) => (next) => async (args
14
14
  else {
15
15
  digest = options.streamHasher(options.md5, body);
16
16
  }
17
- request = {
18
- ...request,
19
- headers: {
20
- ...headers,
21
- "content-md5": options.base64Encoder(await digest),
22
- },
17
+ const cloned = HttpRequest.clone(request);
18
+ cloned.headers = {
19
+ ...headers,
20
+ "content-md5": options.base64Encoder(await digest),
23
21
  };
22
+ return next({
23
+ ...args,
24
+ request: cloned,
25
+ });
24
26
  }
25
27
  }
26
- return next({
27
- ...args,
28
- request,
29
- });
28
+ return next(args);
30
29
  };
31
30
  export const applyMd5BodyChecksumMiddlewareOptions = {
32
31
  name: "applyMd5BodyChecksumMiddleware",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/middleware-apply-body-checksum",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline middleware-apply-body-checksum",
@@ -24,7 +24,7 @@
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
26
  "@smithy/is-array-buffer": "^3.0.0",
27
- "@smithy/protocol-http": "^4.0.4",
27
+ "@smithy/protocol-http": "^4.1.0",
28
28
  "@smithy/types": "^3.3.0",
29
29
  "tslib": "^2.6.2"
30
30
  },
@@ -48,7 +48,7 @@
48
48
  "directory": "packages/middleware-apply-body-checksum"
49
49
  },
50
50
  "devDependencies": {
51
- "@smithy/util-test": "^0.2.5",
51
+ "@smithy/util-test": "^0.2.6",
52
52
  "concurrently": "7.0.0",
53
53
  "downlevel-dts": "0.10.1",
54
54
  "rimraf": "3.0.2",