serverless-aws-lambda
Version:
AWS Application Load Balancer and API Gateway - Lambda dev tool for Serverless. Allows Express synthax in handlers. Supports packaging, local invoking and offline ALB, APG, S3, SNS, SQS, DynamoDB Stream server mocking.
110 lines (109 loc) • 4.72 kB
TypeScript
import type { IncomingMessage, IncomingHttpHeaders } from "http";
import type { LambdaEndpoint } from "../../../lib/parseEvents/endpoints";
export type normalizedSearchParams = {
toString: () => string;
} & {
[key: string]: string[] | undefined;
};
export declare class CommonEventGenerator {
static apiId: string;
static accountId: string;
static port: number;
static serve: any;
static contentType: {
json: string;
text: string;
octet: string;
};
static keepAlive: string[];
static dummyHost: string;
static httpErrMsg: string;
static apigJsonParseErrMsg: string;
static apigForbiddenErrMsg: string;
static amzMsgNull: string;
static apgTimeoutMsg: string;
static unavailable: string;
static timeoutRegex: RegExp;
static apgRequestTimeout: number;
static normalizeHeaderKey: (key: string) => string;
static getMultiValueHeaders: (rawHeaders: string[]) => any;
static getIsBase64Encoded: (headers: IncomingHttpHeaders) => boolean;
static knownHeaders: string[];
static getApiGV1Headers(req: IncomingMessage, mockEvent: LambdaEndpoint): {
headers: any;
multiValueHeaders: Record<string, any[]>;
apiKey: string | undefined;
};
static getCustomHeaders(req: IncomingMessage, mockEvent: LambdaEndpoint): {
accept?: string | undefined;
"accept-language"?: string | undefined;
"accept-patch"?: string | undefined;
"accept-ranges"?: string | undefined;
"access-control-allow-credentials"?: string | undefined;
"access-control-allow-headers"?: string | undefined;
"access-control-allow-methods"?: string | undefined;
"access-control-allow-origin"?: string | undefined;
"access-control-expose-headers"?: string | undefined;
"access-control-max-age"?: string | undefined;
"access-control-request-headers"?: string | undefined;
"access-control-request-method"?: string | undefined;
age?: string | undefined;
allow?: string | undefined;
"alt-svc"?: string | undefined;
authorization?: string | undefined;
"cache-control"?: string | undefined;
connection?: string | undefined;
"content-disposition"?: string | undefined;
"content-encoding"?: string | undefined;
"content-language"?: string | undefined;
"content-length"?: string | undefined;
"content-location"?: string | undefined;
"content-range"?: string | undefined;
"content-type"?: string | undefined;
cookie?: string | undefined;
date?: string | undefined;
etag?: string | undefined;
expect?: string | undefined;
expires?: string | undefined;
forwarded?: string | undefined;
from?: string | undefined;
host?: string | undefined;
"if-match"?: string | undefined;
"if-modified-since"?: string | undefined;
"if-none-match"?: string | undefined;
"if-unmodified-since"?: string | undefined;
"last-modified"?: string | undefined;
location?: string | undefined;
origin?: string | undefined;
pragma?: string | undefined;
"proxy-authenticate"?: string | undefined;
"proxy-authorization"?: string | undefined;
"public-key-pins"?: string | undefined;
range?: string | undefined;
referer?: string | undefined;
"retry-after"?: string | undefined;
"sec-websocket-accept"?: string | undefined;
"sec-websocket-extensions"?: string | undefined;
"sec-websocket-key"?: string | undefined;
"sec-websocket-protocol"?: string | undefined;
"sec-websocket-version"?: string | undefined;
"set-cookie"?: string[] | undefined;
"strict-transport-security"?: string | undefined;
tk?: string | undefined;
trailer?: string | undefined;
"transfer-encoding"?: string | undefined;
upgrade?: string | undefined;
"user-agent"?: string | undefined;
vary?: string | undefined;
via?: string | undefined;
warning?: string | undefined;
"www-authenticate"?: string | undefined;
"X-Forwarded-For": string | undefined;
"X-Forwarded-Proto": string;
"X-Forwarded-Port": string;
};
static getPathParameters(mockEvent: LambdaEndpoint, parsedURL: URL): any;
static normalizeSearchParams: (searchParams: URLSearchParams, rawUrl: string) => normalizedSearchParams;
static getMultiValueQueryStringParameters: (searchParams: URLSearchParams) => any;
static isEndpointTimeoutError: (errorMessage?: string) => boolean | undefined;
}