UNPKG

@adonisjs/http-server

Version:

AdonisJS HTTP server with support packed with Routing and Cookies

47 lines (46 loc) 1.16 kB
import { Readable } from 'node:stream'; /** * Cookie options can that can be set on the response */ export type CookieOptions = { domain: string; expires: Date | (() => Date); httpOnly: boolean; maxAge: number | string; path: string; sameSite: boolean | 'lax' | 'none' | 'strict'; secure: boolean; partitioned?: boolean; priority?: 'low' | 'medium' | 'high'; }; /** * Types from which response header can be casted to a * string */ export type CastableHeader = string | number | boolean | string[] | number[] | boolean[]; /** * Config accepted by response the class */ export type ResponseConfig = { /** * Whether or not to generate etags for responses. Etags can be * enabled/disabled when sending response as well. * * Defaults to false */ etag: boolean; /** * The callback name for the JSONP response. * * Defaults to 'callback' */ jsonpCallbackName: string; /** * Options to set cookies */ cookie: Partial<CookieOptions>; }; /** * Stream that can be piped to the "response.stream" method */ export type ResponseStream = Readable;