@aws-amplify/core
Version:
Core category of aws-amplify
20 lines (17 loc) • 654 B
text/typescript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { HttpRequest } from '../../../../../types';
/**
* Returns signed headers.
*
* @param headers `headers` from the request.
* @returns List of headers included in canonical headers, separated by semicolons (;). This indicates which headers
* are part of the signing process. Header names must use lowercase characters and must appear in alphabetical order.
*
* @internal
*/
export const getSignedHeaders = (headers: HttpRequest['headers']): string =>
Object.keys(headers)
.map(key => key.toLowerCase())
.sort()
.join(';');