@aws-sdk/middleware-sdk-s3 3.413.0 → 3.414.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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCheckContentLengthHeaderPlugin = exports.checkContentLengthHeaderMiddlewareOptions = exports.checkContentLengthHeader = void 0;
|
|
4
4
|
const protocol_http_1 = require("@smithy/protocol-http");
|
|
5
|
+
const smithy_client_1 = require("@smithy/smithy-client");
|
|
5
6
|
const CONTENT_LENGTH_HEADER = "content-length";
|
|
6
7
|
function checkContentLengthHeader() {
|
|
7
8
|
return (next, context) => async (args) => {
|
|
@@ -10,7 +11,7 @@ function checkContentLengthHeader() {
|
|
|
10
11
|
if (protocol_http_1.HttpRequest.isInstance(request)) {
|
|
11
12
|
if (!request.headers[CONTENT_LENGTH_HEADER]) {
|
|
12
13
|
const message = `Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.`;
|
|
13
|
-
if (typeof ((_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.warn) === "function") {
|
|
14
|
+
if (typeof ((_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.warn) === "function" && !(context.logger instanceof smithy_client_1.NoOpLogger)) {
|
|
14
15
|
context.logger.warn(message);
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpRequest } from "@smithy/protocol-http";
|
|
2
|
+
import { NoOpLogger } from "@smithy/smithy-client";
|
|
2
3
|
const CONTENT_LENGTH_HEADER = "content-length";
|
|
3
4
|
export function checkContentLengthHeader() {
|
|
4
5
|
return (next, context) => async (args) => {
|
|
@@ -6,7 +7,7 @@ export function checkContentLengthHeader() {
|
|
|
6
7
|
if (HttpRequest.isInstance(request)) {
|
|
7
8
|
if (!request.headers[CONTENT_LENGTH_HEADER]) {
|
|
8
9
|
const message = `Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.`;
|
|
9
|
-
if (typeof context?.logger?.warn === "function") {
|
|
10
|
+
if (typeof context?.logger?.warn === "function" && !(context.logger instanceof NoOpLogger)) {
|
|
10
11
|
context.logger.warn(message);
|
|
11
12
|
}
|
|
12
13
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-s3",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.414.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@aws-sdk/types": "3.413.0",
|
|
26
26
|
"@aws-sdk/util-arn-parser": "3.310.0",
|
|
27
27
|
"@smithy/protocol-http": "^3.0.3",
|
|
28
|
+
"@smithy/smithy-client": "^2.1.4",
|
|
28
29
|
"@smithy/types": "^2.3.1",
|
|
29
30
|
"tslib": "^2.5.0"
|
|
30
31
|
},
|