[node-bridge] Move helpers to node-bridge (#7451)

This commit is contained in:
Nathan Rajlich
2022-02-17 20:36:37 -08:00
committed by GitHub
parent 27b68be93f
commit c65e7fa883
7 changed files with 1245 additions and 3 deletions

View File

@@ -1,5 +1,11 @@
/// <reference types="node" />
import { Server, IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
import {
Server,
IncomingHttpHeaders,
OutgoingHttpHeaders,
ServerResponse,
IncomingMessage,
} from 'http';
export interface VercelProxyEvent {
Action: string;
body: string;
@@ -37,3 +43,20 @@ export type LauncherConfiguration = {
awsLambdaHandler?: string;
useRequire?: boolean;
};
export type VercelRequestCookies = { [key: string]: string };
export type VercelRequestQuery = { [key: string]: string | string[] };
export type VercelRequestBody = any;
export type VercelRequest = IncomingMessage & {
query: VercelRequestQuery;
cookies: VercelRequestCookies;
body: VercelRequestBody;
};
export type VercelResponse = ServerResponse & {
send: (body: any) => VercelResponse;
json: (jsonBody: any) => VercelResponse;
status: (statusCode: number) => VercelResponse;
redirect: (statusOrUrl: string | number, url?: string) => VercelResponse;
};