UNPKG

@sigiljs/sigil

Version:

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

29 lines (28 loc) 717 B
import i from "./sigil-response.mjs"; class s extends i { /** * HTTP status code for the redirect (300-399). */ code = 302; /** * Target URL for the redirect. */ to; /** * Creates a new Redirect response. * * @param to - The URL to redirect to, set as the Location header. * @param code - Optional redirect status code (must be between 300 and 399). Defaults to 302. * @throws Error if the provided code is not a valid 3xx redirect code. */ constructor(t, r) { if (super(void 0, r ?? 302, { location: t }), this.to = t, r) { if (r < 300 || r > 399) throw new Error("Invalid redirect code: " + r); this.code = r; } } } export { s as default };