@aws-sdk/middleware-flexible-checksums
Advanced tools
Comparing version 3.731.0 to 3.732.0
@@ -404,3 +404,3 @@ "use strict"; | ||
// src/validateChecksumFromResponse.ts | ||
var validateChecksumFromResponse = /* @__PURE__ */ __name(async (response, { config, responseAlgorithms }) => { | ||
var validateChecksumFromResponse = /* @__PURE__ */ __name(async (response, { config, responseAlgorithms, logger }) => { | ||
const checksumAlgorithms = getChecksumAlgorithmListForResponse(responseAlgorithms); | ||
@@ -412,3 +412,12 @@ const { body: responseBody, headers: responseHeaders } = response; | ||
if (checksumFromResponse) { | ||
const checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config); | ||
let checksumAlgorithmFn; | ||
try { | ||
checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config); | ||
} catch (error) { | ||
if (algorithm === "CRC64NVME" /* CRC64NVME */) { | ||
logger?.warn(`Skipping ${"CRC64NVME" /* CRC64NVME */} checksum validation: ${error.message}`); | ||
continue; | ||
} | ||
throw error; | ||
} | ||
const { base64Encoder } = config; | ||
@@ -470,3 +479,4 @@ if (isStreaming(responseBody)) { | ||
config, | ||
responseAlgorithms | ||
responseAlgorithms, | ||
logger: context.logger | ||
}); | ||
@@ -473,0 +483,0 @@ if (isStreamingBody && collectedStream) { |
@@ -44,2 +44,3 @@ import { HttpRequest } from "@smithy/protocol-http"; | ||
responseAlgorithms, | ||
logger: context.logger, | ||
}); | ||
@@ -46,0 +47,0 @@ if (isStreamingBody && collectedStream) { |
import { createChecksumStream } from "@smithy/util-stream"; | ||
import { ChecksumAlgorithm } from "./constants"; | ||
import { getChecksum } from "./getChecksum"; | ||
@@ -7,3 +8,3 @@ import { getChecksumAlgorithmListForResponse } from "./getChecksumAlgorithmListForResponse"; | ||
import { selectChecksumAlgorithmFunction } from "./selectChecksumAlgorithmFunction"; | ||
export const validateChecksumFromResponse = async (response, { config, responseAlgorithms }) => { | ||
export const validateChecksumFromResponse = async (response, { config, responseAlgorithms, logger }) => { | ||
const checksumAlgorithms = getChecksumAlgorithmListForResponse(responseAlgorithms); | ||
@@ -15,3 +16,13 @@ const { body: responseBody, headers: responseHeaders } = response; | ||
if (checksumFromResponse) { | ||
const checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config); | ||
let checksumAlgorithmFn; | ||
try { | ||
checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config); | ||
} | ||
catch (error) { | ||
if (algorithm === ChecksumAlgorithm.CRC64NVME) { | ||
logger?.warn(`Skipping ${ChecksumAlgorithm.CRC64NVME} checksum validation: ${error.message}`); | ||
continue; | ||
} | ||
throw error; | ||
} | ||
const { base64Encoder } = config; | ||
@@ -18,0 +29,0 @@ if (isStreaming(responseBody)) { |
import { HttpResponse } from "@smithy/protocol-http"; | ||
import { Logger } from "@smithy/types"; | ||
import { PreviouslyResolved } from "./configuration"; | ||
@@ -6,6 +7,7 @@ export interface ValidateChecksumFromResponseOptions { | ||
responseAlgorithms?: string[]; | ||
logger?: Logger; | ||
} | ||
export declare const validateChecksumFromResponse: ( | ||
response: HttpResponse, | ||
{ config, responseAlgorithms }: ValidateChecksumFromResponseOptions | ||
{ config, responseAlgorithms, logger }: ValidateChecksumFromResponseOptions | ||
) => Promise<void>; |
import { HttpResponse } from "@smithy/protocol-http"; | ||
import { Logger } from "@smithy/types"; | ||
import { PreviouslyResolved } from "./configuration"; | ||
@@ -10,3 +11,4 @@ export interface ValidateChecksumFromResponseOptions { | ||
responseAlgorithms?: string[]; | ||
logger?: Logger; | ||
} | ||
export declare const validateChecksumFromResponse: (response: HttpResponse, { config, responseAlgorithms }: ValidateChecksumFromResponseOptions) => Promise<void>; | ||
export declare const validateChecksumFromResponse: (response: HttpResponse, { config, responseAlgorithms, logger }: ValidateChecksumFromResponseOptions) => Promise<void>; |
{ | ||
"name": "@aws-sdk/middleware-flexible-checksums", | ||
"version": "3.731.0", | ||
"version": "3.732.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", |
87877
1635
139
5
12
53