UNPKG

@js-thing/http-status-codes

Version:

Contains properly documented HTTP status code enums, reason phrases and helpers as defined in RFC

38 lines (37 loc) 1.55 kB
/** * Checks whether the status code belongs to `HttpServerErrorStatusCodes` enum. * The range is all standard code between [500 - 599] * * To check the entire 5xx range use `is5xxServerErrorStatusCode(code: number)` instead. * @param statusCode - The integer status code. e.g. 100 * @returns `true` if matches `false` otherwise */ export declare const isServerErrorStatusCode: (statusCode: number) => boolean; /** * Checks whether the status code belongs to 5xx family of status codes. * * @param statusCode - The integer status code. e.g. 100 * @returns `true` if matches `false` otherwise */ export declare const is5xxServerErrorStatusCode: (statusCode: number) => boolean; /** * Checks whether the input string belongs to `HttpServerErrorReasonPhrases` enum. * * The match is case sensitive * * @param reasonPhrase - The reason phrase. e.g. 'Ok' * @returns `true` if matches `false` otherwise */ export declare const isServerErrorReasonPhrase: (reasonPhrase: string) => boolean; /** * Checks whether the input integer or string belongs to * `HttpServerErrorStatusCodes` or `HttpServerErrorReasonPhrases` enum. * For integer input, the range is all standard code between [500 - 599]. * For string input, the match is case sensitive. * * To check the entire 5xx range use `is5xxServerErrorStatusCode(code: number)` instead. * @param status - e.g. 'Ok' or 200 * @returns `true` if matches `false` otherwise */ export declare const isServerErrorStatus: (status: string | number) => boolean; export default isServerErrorStatus;