popsicle-status
Version:
Popsicle middleware for rejecting responses with bad HTTP statuses
9 lines (8 loc) • 411 B
TypeScript
import { CommonRequest, CommonResponse } from "servie/dist/common";
export declare class StatusError extends Error {
response: CommonResponse;
status: number;
code: string;
constructor(response: CommonResponse, message: string);
}
export declare function status(min?: number, max?: number): <T extends CommonResponse<unknown>>(req: CommonRequest<unknown>, next: () => Promise<T>) => Promise<T>;