Skip to content

Commit 31e9d06

Browse files
committed
feat(io-ts-http): add all http status codes
1 parent 42dcb8e commit 31e9d06

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,131 @@
11
// TODO: Enforce consistency at the type level
22

33
export const HttpToKeyStatus = {
4+
100: 'continue',
5+
101: 'switchingProtocols',
6+
102: 'processing',
47
200: 'ok',
8+
201: 'created',
9+
202: 'accepted',
10+
203: 'nonAuthoritativeInformation',
11+
204: 'noContent',
12+
205: 'resetContent',
13+
206: 'partialContent',
14+
207: 'multiStatus',
15+
208: 'alreadyReported',
16+
226: 'imUsed',
17+
300: 'multipleChoices',
18+
301: 'movedPermanently',
19+
302: 'found',
20+
303: 'seeOther',
21+
304: 'notModified',
22+
307: 'temporaryRedirect',
23+
308: 'permanentRedirect',
524
400: 'invalidRequest',
625
401: 'unauthenticated',
26+
402: 'paymentRequired',
727
403: 'permissionDenied',
828
404: 'notFound',
29+
405: 'methodNotAllowed',
30+
406: 'notAcceptable',
31+
407: 'proxyAuthenticationRequired',
32+
408: 'requestTimeout',
933
409: 'conflict',
34+
410: 'gone',
35+
411: 'lengthRequired',
36+
412: 'preconditionFailed',
37+
413: 'contentTooLarge',
38+
414: 'uriTooLong',
39+
415: 'unsupportedMediaType',
40+
416: 'rangeNotSatisfiable',
41+
417: 'exceptionFailed',
42+
418: 'imATeapot',
43+
421: 'misdirectedRequest',
44+
422: 'unprocessableContent',
45+
423: 'locked',
46+
424: 'failedDependency',
47+
425: 'tooEarly',
48+
426: 'upgradeRequired',
49+
428: 'preconditionRequired',
1050
429: 'rateLimitExceeded',
51+
431: 'requestHeaderFieldsTooLarge',
52+
451: 'unavailableForLegalReasons',
1153
500: 'internalError',
54+
501: 'notImplemented',
55+
502: 'badGateway',
1256
503: 'serviceUnavailable',
57+
504: 'gatewayTimeout',
58+
505: 'httpVersionNotSupported',
59+
506: 'variantAlsoNegotiates',
60+
507: 'insufficientStorage',
61+
508: 'loopDetected',
62+
510: 'notExtended',
63+
511: 'networkAuthenticationRequired',
1364
} as const;
1465

1566
export type HttpToKeyStatus = typeof HttpToKeyStatus;
1667

1768
export const KeyToHttpStatus = {
69+
continue: 100,
70+
switchingProtocols: 101,
71+
processing: 102,
1872
ok: 200,
73+
created: 201,
74+
accepted: 202,
75+
nonAuthoritativeInformation: 203,
76+
noContent: 204,
77+
resetContent: 205,
78+
partialContent: 206,
79+
multiStatus: 207,
80+
alreadyReported: 208,
81+
imUsed: 226,
82+
multipleChoices: 300,
83+
movedPermanently: 301,
84+
found: 302,
85+
seeOther: 303,
86+
notModified: 304,
87+
temporaryRedirect: 307,
88+
permanentRedirect: 308,
1989
invalidRequest: 400,
2090
unauthenticated: 401,
91+
paymentRequired: 402,
2192
permissionDenied: 403,
2293
notFound: 404,
94+
methodNotAllowed: 405,
95+
notAcceptable: 406,
96+
proxyAuthenticationRequired: 407,
97+
requestTimeout: 408,
2398
conflict: 409,
99+
gone: 410,
100+
lengthRequired: 411,
101+
preconditionFailed: 412,
102+
contentTooLarge: 413,
103+
uriTooLong: 414,
104+
unsupportedMediaType: 415,
105+
rangeNotSatisfiable: 416,
106+
exceptionFailed: 417,
107+
imATeapot: 418,
108+
misdirectedRequest: 421,
109+
unprocessableContent: 422,
110+
locked: 423,
111+
failedDependency: 424,
112+
tooEarly: 425,
113+
upgradeRequired: 426,
114+
preconditionRequired: 428,
24115
rateLimitExceeded: 429,
116+
requestHeaderFieldsTooLarge: 431,
117+
unavailableForLegalReasons: 451,
25118
internalError: 500,
119+
notImplemented: 501,
120+
badGateway: 502,
26121
serviceUnavailable: 503,
122+
gatewayTimeout: 504,
123+
httpVersionNotSupported: 505,
124+
variantAlsoNegotiates: 506,
125+
insufficientStorage: 507,
126+
loopDetected: 508,
127+
notExtended: 510,
128+
networkAuthenticationRequired: 511,
27129
} as const;
28130

29131
export type KeyToHttpStatus = typeof KeyToHttpStatus;

0 commit comments

Comments
 (0)