/** * Status, headers and cookies around a response (SPEC.md §41, §85). * * A handler usually returns the answer and nothing else, which is the point of the * route DSL. Some answers carry more than a body: a session has to arrive as a * cookie the browser will not hand to JavaScript. Wrapping the value keeps that an * explicit act, and keeps the server library out of the handler's type. * * ```ts * handler: async ({ body }) => * respond({ userId }, { cookies: [session(token, expiresAt)] }) * ``` */ export type Cookie = { readonly name: string; readonly value: string; readonly path?: string; readonly expires?: Date; readonly maxAge?: number; readonly httpOnly?: boolean; readonly secure?: boolean; readonly sameSite?: 'strict' | 'lax' | 'none'; }; export type Responded = { readonly node: 'response'; readonly body: T; readonly status: number | undefined; readonly headers: Readonly>; readonly cookies: readonly Cookie[]; }; export declare const respond: (body: T, options?: { readonly status?: number; readonly headers?: Readonly>; readonly cookies?: readonly Cookie[]; }) => Responded; export declare const isResponded: (value: unknown) => value is Responded; export declare const serializeCookie: (cookie: Cookie) => string; //# sourceMappingURL=respond.d.ts.map