This repository has been archived by the owner on Jul 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
276 lines (233 loc) · 11.7 KB
/
index.js
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/**
* The general HttpException class
*/
const HttpException = require('./src/HttpExceptions/HttpException');
/**
* The server cannot or will not process the request due to something that is perceived to be a client error
* (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
*/
const BadRequestHttpException = require('./src/HttpExceptions/4XX/BadRequestHttpException');
/**
* The request has not been applied because it lacks valid authentication credentials for the target resource.
*/
const UnauthorizedHttpException = require('./src/HttpExceptions/4XX/UnauthorizedHttpException');
/**
* Reserved for future use.
*/
const PaymentRequiredHttpException = require('./src/HttpExceptions/4XX/PaymentRequiredHttpException');
/**
* The server understood the request but refuses to authorize it.
*/
const ForbiddenHttpException = require('./src/HttpExceptions/4XX/ForbiddenHttpException');
/**
* The origin server did not find a current representation for the target resource or is not willing to disclose that
* one exists.
*/
const NotFoundHttpException = require('./src/HttpExceptions/4XX/NotFoundHttpException');
/**
* The method received in the request-line is known by the origin server but not supported by the target resource.
*/
const MethodNotAllowedHttpException = require('./src/HttpExceptions/4XX/MethodNotAllowedHttpException');
/**
* The target resource does not have a current representation that would be acceptable to the user agent, according to
* the proactive negotiation header fields received in the request, and the server is unwilling to supply a default
* representation.
*/
const NotAcceptableHttpException = require('./src/HttpExceptions/4XX/NotAcceptableHttpException');
/**
* Similar to 401 Unauthorized, but it indicates that the client needs to authenticate itself in order to use a proxy.
*/
const ProxyAuthenticationRequiredHttpException = require('./src/HttpExceptions/4XX/ProxyAuthenticationRequiredHttpException');
/**
* The server did not receive a complete request message within the time that it was prepared to wait.
*/
const RequestTimeoutHttpException = require('./src/HttpExceptions/4XX/RequestTimeoutHttpException');
/**
* The request could not be completed due to a conflict with the current state of the target resource. This code is used
* in situations where the user might be able to resolve the conflict and resubmit the request.
*/
const ConflictHttpException = require('./src/HttpExceptions/4XX/ConflictHttpException');
/**
* The target resource is no longer available at the origin server and that this condition is likely to be permanent.
*/
const GoneHttpException = require('./src/HttpExceptions/4XX/GoneHttpException');
/**
* The server refuses to accept the request without a defined Content-Length.
*/
const LengthRequiredHttpException = require('./src/HttpExceptions/4XX/LengthRequiredHttpException');
/**
* One or more conditions given in the request header fields evaluated to false when tested on the server.
*/
const PreconditionFailedHttpException = require('./src/HttpExceptions/4XX/PreconditionFailedHttpException');
/**
* The server is refusing to process a request because the request payload is larger than the server is willing or able
* to process.
*/
const PayloadTooLargeHttpException = require('./src/HttpExceptions/4XX/PayloadTooLargeHttpException');
/**
* The server is refusing to service the request because the request-target is longer than the server is willing to interpret.
*/
const RequestUriTooLongHttpException = require('./src/HttpExceptions/4XX/RequestUriTooLongHttpException');
/**
* The origin server is refusing to service the request because the payload is in a format not supported by this method on the
* target resource.
*/
const UnsupportedMediaTypeHttpException = require('./src/HttpExceptions/4XX/UnsupportedMediaTypeHttpException');
/**
* None of the ranges in the request's Range header field1 overlap the current extent of the selected resource or that the set
* of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges.
*/
const RequestedRangeNotSatisfiableHttpException = require('./src/HttpExceptions/4XX/RequestedRangeNotSatisfiableHttpException');
/**
* The expectation given in the request's Expect header field could not be met by at least one of the inbound servers.
*/
const ExpectationFailedHttpException = require('./src/HttpExceptions/4XX/ExpectationFailedHttpException');
/**
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY
* be short and stout.
*/
const IMATeapotHttpException = require('./src/HttpExceptions/4XX/IMATeapotHttpException');
/**
* The request was directed at a server that is not able to produce a response. This can be sent by a server that is not
* configured to produce responses for the combination of scheme and authority that are included in the request URI.
*/
const MisdirectedRequestHttpException = require('./src/HttpExceptions/4XX/MisdirectedRequestHttpException');
/**
* The server understands the content type of the request entity (hence a 415 Unsupported Media Type status code is
* inappropriate), and the syntax of the request entity is correct (thus a 400 Bad Request status code is inappropriate) but was
* unable to process the contained instructions.
*/
const UnprocessableEntityHttpException = require('./src/HttpExceptions/4XX/UnprocessableEntityHttpException');
/**
* The source or destination resource of a method is locked.
*/
const LockedHttpException = require('./src/HttpExceptions/4XX/LockedHttpException');
/**
* The method could not be performed on the resource because the requested action depended on another action and that action
* failed.
*/
const FailedDependencyHttpException = require('./src/HttpExceptions/4XX/FailedDependencyHttpException');
/**
* The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades
* to a different protocol.
*/
const UpgradeRequiredHttpException = require('./src/HttpExceptions/4XX/UpgradeRequiredHttpException');
/**
* The origin server requires the request to be conditional.
*/
const PreconditionRequiredHttpException = require('./src/HttpExceptions/4XX/PreconditionRequiredHttpException');
/**
* The user has sent too many requests in a given amount of time ("rate limiting").
*/
const TooManyRequestsHttpException = require('./src/HttpExceptions/4XX/TooManyRequestsHttpException');
/**
* The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after
* reducing the size of the request header fields.
*/
const RequestHeaderFieldsTooLargeHttpException = require('./src/HttpExceptions/4XX/RequestHeaderFieldsTooLargeHttpException');
/**
* A non-standard status code used to instruct nginx to close the connection without sending a response to the client, most
* commonly used to deny malicious or malformed requests.
*/
const ConnectionClosedWithoutResponseHttpException = require('./src/HttpExceptions/4XX/ConnectionClosedWithoutResponseHttpException');
/**
* The server is denying access to the resource as a consequence of a legal demand.
*/
const UnavailableForLegalReasonsHttpException = require('./src/HttpExceptions/4XX/UnavailableForLegalReasonsHttpException');
/**
* A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing
* the request.
*/
const ClientClosedRequestHttpException = require('./src/HttpExceptions/4XX/ClientClosedRequestHttpException');
/**
* The server encountered an unexpected condition that prevented it from fulfilling the request.
*/
const InternalServerErrorHttpException = require('./src/HttpExceptions/5XX/InternalServerErrorHttpException');
/**
* The server does not support the functionality required to fulfill the request.
*/
const NotImplementedHttpException = require('./src/HttpExceptions/5XX/NotImplementedHttpException');
/**
* The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while
* attempting to fulfill the request.
*/
const BadGatewayHttpException = require('./src/HttpExceptions/5XX/BadGatewayHttpException');
/**
* The server does not support, or refuses to support, the major version of HTTP that was used in the request message.
*/
const HttpVersionNotSupportedHttpException = require('./src/HttpExceptions/5XX/HttpVersionNotSupportedHttpException');
/**
* The server has an internal configuration error: the chosen variant resource is configured to engage in transparent
* content negotiation itself, and is therefore not a proper end point in the negotiation process.
*/
const VariantAlsoNegotiatesHttpException = require('./src/HttpExceptions/5XX/VariantAlsoNegotiatesHttpException');
/**
* The method could not be performed on the resource because the server is unable to store the representation needed
* to successfully complete the request.
*/
const InsufficientStorageHttpException = require('./src/HttpExceptions/5XX/InsufficientStorageHttpException');
/**
* The server terminated an operation because it encountered an infinite loop while processing a request with
* "Depth: infinity". This status indicates that the entire operation failed.
*/
const LoopDetectedHttpException = require('./src/HttpExceptions/5XX/LoopDetectedHttpException');
/**
* The policy for accessing the resource has not been met in the request. The server should send back all the information
* necessary for the client to issue an extended request.
*/
const NotExtendedHttpException = require('./src/HttpExceptions/5XX/NotExtendedHttpException');
/**
* The client needs to authenticate to gain network access.
*/
const NetworkAuthenticationRequiredHttpException = require('./src/HttpExceptions/5XX/NetworkAuthenticationRequiredHttpException');
/**
* This status code is not specified in any RFCs, but is used by some HTTP proxies to signal a network connect timeout behind
* the proxy to a client in front of the proxy.
*/
const NetworkConnectTimeoutErrorHttpException = require('./src/HttpExceptions/5XX/NetworkConnectTimeoutErrorHttpException');
module.exports = {
/* http exception base class */
HttpException,
/* 4XX http exceptions */
BadRequestHttpException,
UnauthorizedHttpException,
PaymentRequiredHttpException,
ForbiddenHttpException,
NotFoundHttpException,
MethodNotAllowedHttpException,
NotAcceptableHttpException,
ProxyAuthenticationRequiredHttpException,
RequestTimeoutHttpException,
ConflictHttpException,
GoneHttpException,
LengthRequiredHttpException,
PreconditionFailedHttpException,
PayloadTooLargeHttpException,
RequestUriTooLongHttpException,
UnsupportedMediaTypeHttpException,
RequestedRangeNotSatisfiableHttpException,
ExpectationFailedHttpException,
IMATeapotHttpException,
MisdirectedRequestHttpException,
UnprocessableEntityHttpException,
LockedHttpException,
FailedDependencyHttpException,
UpgradeRequiredHttpException,
PreconditionRequiredHttpException,
TooManyRequestsHttpException,
RequestHeaderFieldsTooLargeHttpException,
ConnectionClosedWithoutResponseHttpException,
UnavailableForLegalReasonsHttpException,
ClientClosedRequestHttpException,
/* 5XX http exceptions */
InternalServerErrorHttpException,
NotImplementedHttpException,
BadGatewayHttpException,
HttpVersionNotSupportedHttpException,
VariantAlsoNegotiatesHttpException,
InsufficientStorageHttpException,
LoopDetectedHttpException,
NotExtendedHttpException,
NetworkAuthenticationRequiredHttpException,
NetworkConnectTimeoutErrorHttpException,
};