@intuitionrobotics/thunderstorm
Version:
41 lines • 1.55 kB
TypeScript
import { Stream } from "stream";
import { type IncomingHttpHeaders } from "http";
import { type HttpMethod } from "../../../shared/types.js";
import { ApiException } from "../../exceptions.js";
import { type ExpressResponse } from "../../utils/types.js";
export type HttpRequestData = {
originalUrl: string;
headers: IncomingHttpHeaders;
url: string;
query: any;
body: any;
method: HttpMethod;
};
export declare const apiDebug: {
enabled: boolean;
};
export declare class ApiResponse {
private readonly res;
private consumed;
constructor(res: ExpressResponse);
isConsumed(): boolean;
private consume;
stream(responseCode: number, stream: Stream, headers?: any): void;
private printHeaders;
private printResponse;
code(responseCode: number, headers?: any): void;
text(responseCode: number, response?: string, _headers?: any): void;
html(responseCode: number, response?: string, _headers?: any): void;
json(responseCode: number, response?: object | string, _headers?: any): void;
private _json;
end(responseCode: number, response?: object | string, headers?: any): void;
setHeaders(headers: any): void;
setHeader(headerKey: string, value: string | string[]): void;
getHeader(headerKey: string): string | undefined;
redirect(responseCode: number, url: string): void;
exception(exception: ApiException, headers?: any): void;
serverError(error: Error & {
cause?: Error;
}, headers?: any): void;
}
//# sourceMappingURL=server-api.d.ts.map