forked from denosaurs/status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maps.ts
123 lines (120 loc) · 5.27 KB
/
maps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Copyright 2020 Filippo Rossi. All rights reserved. MIT license.
import * as codes from "./codes.ts";
/**
* Mapping all status codes to status phrases.
*/
export const STATUS_MESSAGES: { [key: number]: string } = {
[codes.ACCEPTED]: "ACCEPTED",
[codes.BAD_GATEWAY]: "BAD_GATEWAY",
[codes.BAD_REQUEST]: "BAD_REQUEST",
[codes.CONFLICT]: "CONFLICT",
[codes.CONTINUE]: "CONTINUE",
[codes.CREATED]: "CREATED",
[codes.EXPECTATION_FAILED]: "EXPECTATION_FAILED",
[codes.FAILED_DEPENDENCY]: "FAILED_DEPENDENCY",
[codes.FORBIDDEN]: "FORBIDDEN",
[codes.GATEWAY_TIMEOUT]: "GATEWAY_TIMEOUT",
[codes.GONE]: "GONE",
[codes.HTTP_VERSION_NOT_SUPPORTED]: "HTTP_VERSION_NOT_SUPPORTED",
[codes.IM_A_TEAPOT]: "IM_A_TEAPOT",
[codes.INSUFFICIENT_SPACE_ON_RESOURCE]: "INSUFFICIENT_SPACE_ON_RESOURCE",
[codes.INSUFFICIENT_STORAGE]: "INSUFFICIENT_STORAGE",
[codes.INTERNAL_SERVER_ERROR]: "INTERNAL_SERVER_ERROR",
[codes.LENGTH_REQUIRED]: "LENGTH_REQUIRED",
[codes.LOCKED]: "LOCKED",
[codes.METHOD_FAILURE]: "METHOD_FAILURE",
[codes.METHOD_NOT_ALLOWED]: "METHOD_NOT_ALLOWED",
[codes.MOVED_PERMANENTLY]: "MOVED_PERMANENTLY",
[codes.MOVED_TEMPORARILY]: "MOVED_TEMPORARILY",
[codes.MULTI_STATUS]: "MULTI_STATUS",
[codes.MULTIPLE_CHOICES]: "MULTIPLE_CHOICES",
[codes.NETWORK_AUTHENTICATION_REQUIRED]: "NETWORK_AUTHENTICATION_REQUIRED",
[codes.NO_CONTENT]: "NO_CONTENT",
[codes.NON_AUTHORITATIVE_INFORMATION]: "NON_AUTHORITATIVE_INFORMATION",
[codes.NOT_ACCEPTABLE]: "NOT_ACCEPTABLE",
[codes.NOT_FOUND]: "NOT_FOUND",
[codes.NOT_IMPLEMENTED]: "NOT_IMPLEMENTED",
[codes.NOT_MODIFIED]: "NOT_MODIFIED",
[codes.OK]: "OK",
[codes.PARTIAL_CONTENT]: "PARTIAL_CONTENT",
[codes.PAYMENT_REQUIRED]: "PAYMENT_REQUIRED",
[codes.PERMANENT_REDIRECT]: "PERMANENT_REDIRECT",
[codes.PRECONDITION_FAILED]: "PRECONDITION_FAILED",
[codes.PRECONDITION_REQUIRED]: "PRECONDITION_REQUIRED",
[codes.PROCESSING]: "PROCESSING",
[codes.PROXY_AUTHENTICATION_REQUIRED]: "PROXY_AUTHENTICATION_REQUIRED",
[codes.REQUEST_HEADER_FIELDS_TOO_LARGE]: "REQUEST_HEADER_FIELDS_TOO_LARGE",
[codes.REQUEST_TIMEOUT]: "REQUEST_TIMEOUT",
[codes.REQUEST_TOO_LONG]: "REQUEST_TOO_LONG",
[codes.REQUEST_URI_TOO_LONG]: "REQUEST_URI_TOO_LONG",
[codes.REQUESTED_RANGE_NOT_SATISFIABLE]: "REQUESTED_RANGE_NOT_SATISFIABLE",
[codes.RESET_CONTENT]: "RESET_CONTENT",
[codes.SEE_OTHER]: "SEE_OTHER",
[codes.SERVICE_UNAVAILABLE]: "SERVICE_UNAVAILABLE",
[codes.SWITCHING_PROTOCOLS]: "SWITCHING_PROTOCOLS",
[codes.TEMPORARY_REDIRECT]: "TEMPORARY_REDIRECT",
[codes.TOO_MANY_REQUESTS]: "TOO_MANY_REQUESTS",
[codes.UNAUTHORIZED]: "UNAUTHORIZED",
[codes.UNPROCESSABLE_ENTITY]: "UNPROCESSABLE_ENTITY",
[codes.UNSUPPORTED_MEDIA_TYPE]: "UNSUPPORTED_MEDIA_TYPE",
[codes.USE_PROXY]: "USE_PROXY",
};
/**
* Mapping all status phrases to status codes.
*/
export const STATUS_CODES: { [key: string]: number } = {
"ACCEPTED": codes.ACCEPTED,
"BAD_GATEWAY": codes.BAD_GATEWAY,
"BAD_REQUEST": codes.BAD_REQUEST,
"CONFLICT": codes.CONFLICT,
"CONTINUE": codes.CONTINUE,
"CREATED": codes.CREATED,
"EXPECTATION_FAILED": codes.EXPECTATION_FAILED,
"FAILED_DEPENDENCY": codes.FAILED_DEPENDENCY,
"FORBIDDEN": codes.FORBIDDEN,
"GATEWAY_TIMEOUT": codes.GATEWAY_TIMEOUT,
"GONE": codes.GONE,
"HTTP_VERSION_NOT_SUPPORTED": codes.HTTP_VERSION_NOT_SUPPORTED,
"IM_A_TEAPOT": codes.IM_A_TEAPOT,
"INSUFFICIENT_SPACE_ON_RESOURCE": codes.INSUFFICIENT_SPACE_ON_RESOURCE,
"INSUFFICIENT_STORAGE": codes.INSUFFICIENT_STORAGE,
"INTERNAL_SERVER_ERROR": codes.INTERNAL_SERVER_ERROR,
"LENGTH_REQUIRED": codes.LENGTH_REQUIRED,
"LOCKED": codes.LOCKED,
"METHOD_FAILURE": codes.METHOD_FAILURE,
"METHOD_NOT_ALLOWED": codes.METHOD_NOT_ALLOWED,
"MOVED_PERMANENTLY": codes.MOVED_PERMANENTLY,
"MOVED_TEMPORARILY": codes.MOVED_TEMPORARILY,
"MULTI_STATUS": codes.MULTI_STATUS,
"MULTIPLE_CHOICES": codes.MULTIPLE_CHOICES,
"NETWORK_AUTHENTICATION_REQUIRED": codes.NETWORK_AUTHENTICATION_REQUIRED,
"NO_CONTENT": codes.NO_CONTENT,
"NON_AUTHORITATIVE_INFORMATION": codes.NON_AUTHORITATIVE_INFORMATION,
"NOT_ACCEPTABLE": codes.NOT_ACCEPTABLE,
"NOT_FOUND": codes.NOT_FOUND,
"NOT_IMPLEMENTED": codes.NOT_IMPLEMENTED,
"NOT_MODIFIED": codes.NOT_MODIFIED,
"OK": codes.OK,
"PARTIAL_CONTENT": codes.PARTIAL_CONTENT,
"PAYMENT_REQUIRED": codes.PAYMENT_REQUIRED,
"PERMANENT_REDIRECT": codes.PERMANENT_REDIRECT,
"PRECONDITION_FAILED": codes.PRECONDITION_FAILED,
"PRECONDITION_REQUIRED": codes.PRECONDITION_REQUIRED,
"PROCESSING": codes.PROCESSING,
"PROXY_AUTHENTICATION_REQUIRED": codes.PROXY_AUTHENTICATION_REQUIRED,
"REQUEST_HEADER_FIELDS_TOO_LARGE": codes.REQUEST_HEADER_FIELDS_TOO_LARGE,
"REQUEST_TIMEOUT": codes.REQUEST_TIMEOUT,
"REQUEST_TOO_LONG": codes.REQUEST_TOO_LONG,
"REQUEST_URI_TOO_LONG": codes.REQUEST_URI_TOO_LONG,
"REQUESTED_RANGE_NOT_SATISFIABLE": codes.REQUESTED_RANGE_NOT_SATISFIABLE,
"RESET_CONTENT": codes.RESET_CONTENT,
"SEE_OTHER": codes.SEE_OTHER,
"SERVICE_UNAVAILABLE": codes.SERVICE_UNAVAILABLE,
"SWITCHING_PROTOCOLS": codes.SWITCHING_PROTOCOLS,
"TEMPORARY_REDIRECT": codes.TEMPORARY_REDIRECT,
"TOO_MANY_REQUESTS": codes.TOO_MANY_REQUESTS,
"UNAUTHORIZED": codes.UNAUTHORIZED,
"UNPROCESSABLE_ENTITY": codes.UNPROCESSABLE_ENTITY,
"UNSUPPORTED_MEDIA_TYPE": codes.UNSUPPORTED_MEDIA_TYPE,
"USE_PROXY": codes.USE_PROXY,
};