UNPKG

1.09 kBTypeScriptView Raw
1/**
2 * Returns the reason phrase for the given status code.
3 * If the given status code does not exist, an error is thrown.
4 *
5 * @param {number|string} statusCode The HTTP status code
6 * @returns {string} The associated reason phrase (e.g. "Bad Request", "OK")
7 * */
8export declare function getReasonPhrase(statusCode: (number | string)): (string);
9/**
10 * Returns the status code for the given reason phrase.
11 * If the given reason phrase does not exist, undefined is returned.
12 *
13 * @param {string} reasonPhrase The HTTP reason phrase (e.g. "Bad Request", "OK")
14 * @returns {string} The associated status code
15 * */
16export declare function getStatusCode(reasonPhrase: string): (number);
17/**
18 * @deprecated
19 *
20 * Returns the reason phrase for the given status code.
21 * If the given status code does not exist, undefined is returned.
22 *
23 * Deprecated in favor of getReasonPhrase
24 *
25 * @param {number|string} statusCode The HTTP status code
26 * @returns {string|undefined} The associated reason phrase (e.g. "Bad Request", "OK")
27 * */
28export declare const getStatusText: typeof getReasonPhrase;