| 34 | } |
| 35 | |
| 36 | export interface CpeakResponse<ResBody = any> extends ServerResponse { |
| 37 | sendFile: (path: string, mime?: string) => Promise<void>; |
| 38 | status: (code: number) => CpeakResponse<ResBody>; |
| 39 | attachment: (filename?: string) => CpeakResponse<ResBody>; |
| 40 | cookie: (name: string, value: string, options?: CookieOptions) => CpeakResponse<ResBody>; |
| 41 | redirect: (location: string) => void; |
| 42 | json: (data: ResBody) => Promise<void>; |
| 43 | compress: ( |
| 44 | mime: string, |
| 45 | body: Buffer | string | Readable, |
| 46 | size?: number |
| 47 | ) => Promise<void>; |
| 48 | render: ( |
| 49 | filePath: string, |
| 50 | data: Record<string, unknown>, |
| 51 | mime?: string |
| 52 | ) => Promise<void>; |
| 53 | [key: string]: any; // allow developers to add their onw extensions (e.g. res.test) |
| 54 | } |
| 55 | |
| 56 | export type Next = (err?: any) => void; |
| 57 |
nothing calls this directly
no outgoing calls
no test coverage detected