UNPKG

@aws-lambda-powertools/tracer

Version:
29 lines 1.41 kB
import { URL } from 'node:url'; import type { Segment, Subsegment } from 'aws-xray-sdk-core'; import type { DiagnosticsChannel } from 'undici-types'; import type { HttpSubsegment } from '../types/ProviderService.js'; /** * The `fetch` implementation based on `undici` includes the headers as an array of encoded key-value pairs. * This function finds the header with the given key and decodes the value. * * The function walks through the array of encoded headers and decodes the key of each pair. * If the key matches the given key, the function returns the decoded value of the next element in the array. * * @param encodedHeaders The array of encoded headers * @param key The key to search for */ declare const findHeaderAndDecode: (encodedHeaders: Uint8Array[], key: string) => string | null; /** * Type guard to check if the given subsegment is an `HttpSubsegment` * * @param subsegment The subsegment to check */ declare const isHttpSubsegment: (subsegment: Segment | Subsegment | undefined) => subsegment is HttpSubsegment; /** * Convert the origin url to a URL object when it is a string and append the path if provided * * @param origin The request object containing the origin url and path */ declare const getRequestURL: (request: DiagnosticsChannel.Request) => URL | undefined; export { findHeaderAndDecode, isHttpSubsegment, getRequestURL }; //# sourceMappingURL=utilities.d.ts.map