forked from zhmushan/abc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.ts
97 lines (93 loc) · 3.61 KB
/
constants.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
const charsetUTF8 = "charset=UTF-8";
export namespace HttpMethod {
export const Get = "GET",
Head = "HEAD",
Post = "POST",
Put = "PUT",
Patch = "PATCH",
Delete = "DELETE",
Connect = "CONNECT",
Options = "OPTIONS",
Trace = "TRACE";
}
export namespace Header {
export const Accept = "Accept",
AcceptEncoding = "Accept-Encoding",
Allow = "Allow",
Authorization = "Authorization",
ContentDisposition = "Content-Disposition",
ContentEncoding = "Content-Encoding",
ContentLength = "Content-Length",
ContentType = "Content-Type",
Cookie = "Cookie",
SetCookie = "Set-Cookie",
IfModifiedSince = "If-Modified-Since",
LastModified = "Last-Modified",
Location = "Location",
Upgrade = "Upgrade",
Vary = "Vary",
WWWAuthenticate = "WWW-Authenticate",
XForwardedFor = "X-Forwarded-For",
XForwardedProto = "X-Forwarded-Proto",
XForwardedProtocol = "X-Forwarded-Protocol",
XForwardedSsl = "X-Forwarded-Ssl",
XUrlScheme = "X-Url-Scheme",
XHTTPMethodOverride = "X-HTTP-Method-Override",
XRealIP = "X-Real-IP",
XRequestID = "X-Request-ID",
XRequestedWith = "X-Requested-With",
Server = "Server",
Origin = "Origin", // Access control
AccessControlRequestMethod = "Access-Control-Request-Method",
AccessControlRequestHeaders = "Access-Control-Request-Headers",
AccessControlAllowOrigin = "Access-Control-Allow-Origin",
AccessControlAllowMethods = "Access-Control-Allow-Methods",
AccessControlAllowHeaders = "Access-Control-Allow-Headers",
AccessControlAllowCredentials = "Access-Control-Allow-Credentials",
AccessControlExposeHeaders = "Access-Control-Expose-Headers",
AccessControlMaxAge = "Access-Control-Max-Age", // Security
StrictTransportSecurity = "Strict-Transport-Security",
XContentTypeOptions = "X-Content-Type-Options",
XXSSProtection = "X-XSS-Protection",
XFrameOptions = "X-Frame-Options",
ContentSecurityPolicy = "Content-Security-Policy",
ContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only",
XCSRFToken = "X-CSRF-Token",
ReferrerPolicy = "Referrer-Policy";
}
export namespace MIME {
export const ApplicationGZip = "application/gzip",
ApplicationJSON = "application/json",
ApplicationJSONCharsetUTF8 = ApplicationJSON + "; " + charsetUTF8,
ApplicationJavaScript = "application/javascript",
ApplicationJavaScriptCharsetUTF8 = ApplicationJavaScript + "; " +
charsetUTF8,
ApplicationXML = "application/xml",
ApplicationXMLCharsetUTF8 = ApplicationXML + "; " + charsetUTF8,
TextMarkdown = "text/markdown",
TextMarkdownCharsetUTF8 = TextMarkdown + "; " + charsetUTF8,
TextXML = "text/xml",
TextXMLCharsetUTF8 = TextXML + "; " + charsetUTF8,
ApplicationForm = "application/x-www-form-urlencoded",
ApplicationProtobuf = "application/protobuf",
ApplicationMsgpack = "application/msgpack",
TextHTML = "text/html",
TextHTMLCharsetUTF8 = TextHTML + "; " + charsetUTF8,
TextPlain = "text/plain",
TextPlainCharsetUTF8 = TextPlain + "; " + charsetUTF8,
MultipartForm = "multipart/form-data",
OctetStream = "application/octet-stream";
export const DB: Record<string, string | undefined> = {
".md": TextMarkdownCharsetUTF8,
".html": TextHTMLCharsetUTF8,
".htm": TextHTMLCharsetUTF8,
".json": ApplicationJSON,
".map": ApplicationJSON,
".txt": TextPlainCharsetUTF8,
".ts": ApplicationJavaScriptCharsetUTF8,
".tsx": ApplicationJavaScriptCharsetUTF8,
".js": ApplicationJavaScriptCharsetUTF8,
".jsx": ApplicationJavaScriptCharsetUTF8,
".gz": ApplicationGZip,
};
}