UNPKG

@aws-amplify/core

Version:
22 lines (20 loc) 812 B
'use strict'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.parseMetadata = void 0; const parseMetadata = (response) => { const { headers, statusCode } = response; return { ...(isMetadataBearer(response) ? response.$metadata : {}), httpStatusCode: statusCode, requestId: headers['x-amzn-requestid'] ?? headers['x-amzn-request-id'] ?? headers['x-amz-request-id'], extendedRequestId: headers['x-amz-id-2'], cfId: headers['x-amz-cf-id'], }; }; exports.parseMetadata = parseMetadata; const isMetadataBearer = (response) => typeof response?.$metadata === 'object'; //# sourceMappingURL=responseInfo.js.map