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.
74 lines (73 loc) • 1.91 kB
TypeScript
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
export interface RawAPIResponseContent {
cookies?: string[];
isBase64Encoded?: boolean;
statusCode: number;
headers?: {
[key: string]: any;
};
body?: string | null | undefined;
}
export interface RawResponseContent {
statusCode: number;
[key: string]: any;
}
export interface KnownRequestProperties {
requestContext: {
[key: string]: any;
};
httpMethod: HttpMethod;
queryStringParameters: {
[key: string]: string;
};
path: string;
headers: any;
isBase64Encoded: boolean;
/**
* parsed queryStringParameters.
*
* Values may be `array` if multiValueQueryStringParameters is available and there's multiples values for the key.
*
*/
query: any;
/**
* Request body.
*
* Tries to parse with JSON.parse().
*
* Use `body-parser` middleware from `serverless-aws-lambda/body-parser` to parse Form-Data and x-www-form-urlencoded.
*/
body: any;
method: HttpMethod;
/**
* Get header value by key.
*
* Case insensitive.
*/
get: (headerKey: string) => string | string[];
/**
* request url splitted with `/`.
*/
params: string[];
protocol: string;
secure: boolean;
/**
* Use `body-parser` middleware from `serverless-aws-lambda/body-parser` to get files as Buffers.
*
* Otherwise it will be undefined.
*/
files?: any[];
/**
* Use {@link https://www.npmjs.com/package/cookie-parser cookie-parser} middleware to get parsed cookies.
*
* Otherwise it will be undefined.
*/
cookies?: {
[key: string]: any;
};
}
export type IRequest = KnownRequestProperties & {
[key: string]: any;
};
export declare const _buildUniversalEvent: (event: any) => any;
export {};