UNPKG

@sigiljs/sigil

Version:

TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating

18 lines (17 loc) 783 B
import { default as SigilResponse } from './sigil-response'; /** * Response class for sending raw payloads, with automatic JSON content-type * when the body is an object and no headers are provided. * Extends SigilResponse to customize headers based on payload type. */ export default class RawResponse extends SigilResponse { /** * Constructs a new RawResponse. * * @param body - The response payload, can be any type. * @param headers - Optional HTTP headers or init object. If omitted and `body` is an object, * `Content-Type: application/json` will be set automatically. * @param code - Optional HTTP status code. Defaults to 200. */ constructor(body: any, headers?: Headers | HeadersInit | Record<string, any>, code?: number); }