6 TextPlain: 'text/plain',
7 ApplicationForm: 'application/x-www-form-urlencoded',
8 ApplicationJson: 'application/json',
11 // Supported encoding types
12 const EncodingType
= {
19 // Filename suffixes for serving pre-encoded files
20 const EncodingTypeSuffix
= {
21 [EncodingType
.Brotli
]: '.br',
22 [EncodingType
.Gzip
]: '.gz',
23 [EncodingType
.XGzip
]: '.gz',
26 const ErrorResponse
= {
29 errorMessage: 'Bad Request',
33 errorMessage: 'Unauthorized',
37 errorMessage: 'Forbidden',
41 errorMessage: 'F̦̩̫̼͔̫͓̃ͤ̈̆̀͑o̖̟͙̫̯̗̳̽ͦ̆́ͨr̩͉̰̗͉b̬̂͘į̟̬̓d͂͗҉̟͈̜͙ͅd͎̜̺̝͇͑̒̋̾ë̴̳̺͓̦̘́ͮ̈́ǹ͈̦̫̙',
45 errorMessage: 'Not Found',
49 errorMessage: 'Method Not Allowed',
53 errorMessage: 'Not Acceptable',
59 RequestEntityTooLarge: {
61 errorMessage: 'Request Entity Too Large',
63 UnsupportedMediaType: {
65 errorMessage: 'Unsupported Media Type',
67 InternalServerError: {
69 errorMessage: 'Internal Server Error',
73 const ErrorResponseDefaultProxy
= new Proxy(ErrorResponse
, {
74 get: (target
, property
) => {
75 // eslint-disable-next-line security/detect-object-injection
76 return (property
in target
) ? target
[property
] : {
77 errorMessage: `undefined error response '${property}'`,
84 AcceptEncoding: 'Accept-Encoding',
85 CacheControl: 'Cache-Control',
86 ContentEncoding: 'Content-Encoding',
87 ContentLength: 'Content-Length',
88 ContentType: 'Content-Type',
90 IfModifiedSince: 'If-Modified-Since',
91 IfNoneMatch: 'If-None-Match',
92 LastModified: 'Last-Modified',
94 RequestId: 'Request-ID',
96 XCorrelationId: 'X-Correlation-ID',
97 XForwardedFor: 'X-Forwarded-For',
98 XForwardedProto: 'X-Forwarded-Proto',
100 XRequestId: 'X-Request-ID',
107 ErrorResponse: ErrorResponseDefaultProxy
,