edgerender
Version:
Render at the edge
26 lines (25 loc) • 953 B
TypeScript
export declare enum MimeTypes {
html = "text/html",
plaintext = "text/plain",
json = "application/json",
ico = "image/vnd.microsoft.icon",
octetStream = "application/octet-stream"
}
export declare const default_security_headers: Record<string, string>;
export interface PreResponse {
status?: number;
body: string | ReadableStream | ArrayBuffer;
mime_type: MimeTypes | string;
headers?: Record<string, string>;
}
export declare function json_response(obj: Record<string, any>, status?: number): PreResponse;
export declare class HttpError extends Error {
status: number;
body: string;
headers: Record<string, string>;
constructor(status: number, body: string, headers?: Record<string, string> | undefined);
response(request: Request): PreResponse;
}
export declare class Redirect extends HttpError {
constructor(location: string, status?: 301 | 302 | 303 | 307 | 308, body?: string | null);
}