@aws-amplify/storage
Version:
Storage category of aws-amplify
36 lines (32 loc) • 1.05 kB
text/typescript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
retryMiddleware,
RetryOptions,
signingMiddleware,
SigningOptions,
userAgentMiddleware,
UserAgentOptions,
HttpRequest,
HttpResponse,
} from '@aws-amplify/core/internals/aws-client-utils';
import { composeTransferHandler } from '@aws-amplify/core/internals/aws-client-utils/composers';
import { contentSha256Middleware } from '../contentSha256middleware';
import { xhrTransferHandler } from '../xhrTransferHandler';
/**
* S3 transfer handler for browser and React Native based on XHR. On top of basic transfer handler, it also supports
* x-amz-content-sha256 header, and request&response process tracking.
*
* @internal
*/
export const s3TransferHandler = composeTransferHandler<
[{}, UserAgentOptions, RetryOptions<HttpResponse>, SigningOptions],
HttpRequest,
HttpResponse,
typeof xhrTransferHandler
>(xhrTransferHandler, [
contentSha256Middleware,
userAgentMiddleware,
retryMiddleware,
signingMiddleware,
]);