@d1g1tal/transportr 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/transportr.js +887 -0
- package/dist/transportr.min.js +4 -0
- package/dist/transportr.min.js.map +7 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/package.json +70 -0
- package/src/http-media-type.d.ts +149 -0
- package/src/http-media-type.js +150 -0
- package/src/http-request-headers.d.ts +43 -0
- package/src/http-request-headers.js +306 -0
- package/src/http-request-methods.d.ts +12 -0
- package/src/http-request-methods.js +271 -0
- package/src/http-response-headers.d.ts +46 -0
- package/src/http-response-headers.js +344 -0
- package/src/transportr.d.ts +509 -0
- package/src/transportr.js +462 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
const HttpRequestMethod = {
|
|
2
|
+
/**
|
|
3
|
+
* The OPTIONS method represents a request for information about the communication options available on the
|
|
4
|
+
* request/response chain identified by the Request-URI. This method allows the client to determine the options and/or
|
|
5
|
+
* requirements associated with a resource, or the capabilities of a server, without implying a resource action or
|
|
6
|
+
* initiating a resource retrieval.
|
|
7
|
+
*
|
|
8
|
+
* Responses to this method are not cacheable.
|
|
9
|
+
*
|
|
10
|
+
* If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or
|
|
11
|
+
* Transfer-Encoding), then the media type MUST be indicated by a Content-Type field. Although this specification does
|
|
12
|
+
* not define any use for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed
|
|
13
|
+
* queries on the server. A server that does not support such an extension MAY discard the request body.
|
|
14
|
+
*
|
|
15
|
+
* If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather
|
|
16
|
+
* than to a specific resource. Since a server's communication options typically depend on the resource, the "*"
|
|
17
|
+
* request is only useful as a "ping" or "no-op" type of method, it does nothing beyond allowing the client to test the
|
|
18
|
+
* capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof).
|
|
19
|
+
*
|
|
20
|
+
* If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when
|
|
21
|
+
* communicating with that resource.
|
|
22
|
+
*
|
|
23
|
+
* A 200 response SHOULD include any header fields that indicate optional features implemented by the server and
|
|
24
|
+
* applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The
|
|
25
|
+
* response body, if any, SHOULD also include information about the communication options. The format for such a body
|
|
26
|
+
* is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY be
|
|
27
|
+
* used to select the appropriate response format. If no response body is included, the response MUST include a
|
|
28
|
+
* Content-Length field with a field-value of "0".
|
|
29
|
+
*
|
|
30
|
+
* The Max-Forwards request-header field MAY be used to target a specific proxy in the request chain. When a proxy
|
|
31
|
+
* receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy MUST check for a
|
|
32
|
+
* Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy MUST NOT forward the message, instead,
|
|
33
|
+
* the proxy SHOULD respond with its own communication options. If the Max-Forwards field-value is an integer greater
|
|
34
|
+
* than zero, the proxy MUST decrement the field-value when it forwards the request. If no Max-Forwards field is
|
|
35
|
+
* present in the request, then the forwarded request MUST NOT include a Max-Forwards field.
|
|
36
|
+
*/
|
|
37
|
+
OPTIONS: 'OPTIONS',
|
|
38
|
+
/**
|
|
39
|
+
* The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If
|
|
40
|
+
* the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in
|
|
41
|
+
* the response and not the source text of the process, unless that text happens to be the output of the process.
|
|
42
|
+
*
|
|
43
|
+
* The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since;
|
|
44
|
+
* If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the
|
|
45
|
+
* entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET
|
|
46
|
+
* method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring
|
|
47
|
+
* multiple requests or transferring data already held by the client.
|
|
48
|
+
*
|
|
49
|
+
* The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A
|
|
50
|
+
* partial GET requests that only part of the entity be transferred, as described in section 14.35. The partial GET
|
|
51
|
+
* method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed
|
|
52
|
+
* without transferring data already held by the client.
|
|
53
|
+
*
|
|
54
|
+
* The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching described in
|
|
55
|
+
* section 13.
|
|
56
|
+
*
|
|
57
|
+
* See section 15.1.3 for security considerations when used for forms.
|
|
58
|
+
*/
|
|
59
|
+
GET: 'GET',
|
|
60
|
+
/**
|
|
61
|
+
* The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The
|
|
62
|
+
* meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information
|
|
63
|
+
* sent in response to a GET request. This method can be used for obtaining meta information about the entity implied by
|
|
64
|
+
* the request without transferring the entity-body itself. This method is often used for testing hypertext links for
|
|
65
|
+
* validity, accessibility, and recent modification.
|
|
66
|
+
*
|
|
67
|
+
* The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY be
|
|
68
|
+
* used to update a previously cached entity from that resource. If the new field values indicate that the cached
|
|
69
|
+
* entity differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or
|
|
70
|
+
* Last-Modified), then the cache MUST treat the cache entry as stale.
|
|
71
|
+
*/
|
|
72
|
+
HEAD: 'HEAD',
|
|
73
|
+
/**
|
|
74
|
+
* The POST method is used to request that the origin server accept the entity enclosed in the request as a new
|
|
75
|
+
* subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform
|
|
76
|
+
* method to cover the following functions:
|
|
77
|
+
* <ul>
|
|
78
|
+
* <li>Annotation of existing resources,</li>
|
|
79
|
+
* <li>Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles,</li>
|
|
80
|
+
* <li>Providing a block of data, such as the result of submitting a form, to a data-handling process,</li>
|
|
81
|
+
* <li>Extending a database through an append operation.</li>
|
|
82
|
+
* </ul>
|
|
83
|
+
*
|
|
84
|
+
* The actual function performed by the POST method is determined by the server and is usually dependent on the
|
|
85
|
+
* Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory
|
|
86
|
+
* containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a
|
|
87
|
+
* database.
|
|
88
|
+
*
|
|
89
|
+
* The action performed by the POST method might not result in a resource that can be identified by a URI. In this
|
|
90
|
+
* case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the
|
|
91
|
+
* response includes an entity that describes the result.
|
|
92
|
+
*
|
|
93
|
+
* If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity
|
|
94
|
+
* which describes the status of the request and refers to the new resource, and a Location header (see section 14.30).
|
|
95
|
+
*
|
|
96
|
+
* Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header
|
|
97
|
+
* fields. However, the 303 (See Other) response can be used to direct the user agent to retrieve a cacheable resource.
|
|
98
|
+
*
|
|
99
|
+
* POST requests MUST obey the message transmission requirements set out in section 8.2.
|
|
100
|
+
*
|
|
101
|
+
* See section 15.1.3 for security considerations.
|
|
102
|
+
*/
|
|
103
|
+
POST: 'POST',
|
|
104
|
+
/**
|
|
105
|
+
* The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers
|
|
106
|
+
* to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing
|
|
107
|
+
* on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being
|
|
108
|
+
* defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If
|
|
109
|
+
* a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an
|
|
110
|
+
* existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate
|
|
111
|
+
* successful completion of the request. If the resource could not be created or modified with the Request-URI, an
|
|
112
|
+
* appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST
|
|
113
|
+
* \NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a
|
|
114
|
+
* 501 (Not Implemented) response in such cases.
|
|
115
|
+
*
|
|
116
|
+
* If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those
|
|
117
|
+
* entries SHOULD be treated as stale. Responses to this method are not cacheable.
|
|
118
|
+
*
|
|
119
|
+
* The fundamental difference between the POST and PUT requests is reflected in the different meaning of the
|
|
120
|
+
* Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource
|
|
121
|
+
* might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations.
|
|
122
|
+
* In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what
|
|
123
|
+
* URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires
|
|
124
|
+
* that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response, the user agent MAY
|
|
125
|
+
* then make its own decision regarding whether or not to redirect the request.
|
|
126
|
+
*
|
|
127
|
+
* A single resource MAY be identified by many different URIs. For example, an article might have a URI for identifying
|
|
128
|
+
* "the current version" which is separate from the URI identifying each particular version. In this case, a PUT
|
|
129
|
+
* request on a general URI might result in several other URIs being defined by the origin server.
|
|
130
|
+
*
|
|
131
|
+
* HTTP/1.1 does not define how a PUT method affects the state of an origin server.
|
|
132
|
+
*
|
|
133
|
+
* PUT requests MUST obey the message transmission requirements set out in section 8.2.
|
|
134
|
+
*
|
|
135
|
+
* Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request SHOULD be applied
|
|
136
|
+
* to the resource created or modified by the PUT.
|
|
137
|
+
*/
|
|
138
|
+
PUT: 'PUT',
|
|
139
|
+
/**
|
|
140
|
+
* The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY
|
|
141
|
+
* be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the
|
|
142
|
+
* operation has been carried out, even if the status code returned from the origin server indicates that the action
|
|
143
|
+
* has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response
|
|
144
|
+
* is given, it intends to delete the resource or move it to an inaccessible location.
|
|
145
|
+
*
|
|
146
|
+
* A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if
|
|
147
|
+
* the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not
|
|
148
|
+
* include an entity.
|
|
149
|
+
*
|
|
150
|
+
* If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those
|
|
151
|
+
* entries SHOULD be treated as stale. Responses to this method are not cacheable.
|
|
152
|
+
*/
|
|
153
|
+
DELETE: 'DELETE',
|
|
154
|
+
/**
|
|
155
|
+
* The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final
|
|
156
|
+
* recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK)
|
|
157
|
+
* response. The final recipient is either the origin server or the first proxy or gateway to receive a Max-Forwards
|
|
158
|
+
* value of zero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity.
|
|
159
|
+
*
|
|
160
|
+
* TRACE allows the client to see what is being received at the other end of the request chain and use that data for
|
|
161
|
+
* testing or diagnostic information. The value of the Via header field (section 14.45) is of particular interest,
|
|
162
|
+
* since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the
|
|
163
|
+
* length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop.
|
|
164
|
+
*
|
|
165
|
+
* If the request is valid, the response SHOULD contain the entire request message in the entity-body, with a
|
|
166
|
+
* Content-Type of "message/http". Responses to this method MUST NOT be cached.
|
|
167
|
+
*/
|
|
168
|
+
TRACE: 'TRACE',
|
|
169
|
+
/**
|
|
170
|
+
* This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a
|
|
171
|
+
* tunnel (e.g. SSL tunneling [44]).
|
|
172
|
+
*/
|
|
173
|
+
CONNECT: 'CONNECT',
|
|
174
|
+
/**
|
|
175
|
+
* The PATCH method requests that a set of changes described in the
|
|
176
|
+
* request entity be applied to the resource identified by the Request-
|
|
177
|
+
* URI. The set of changes is represented in a format called a "patch
|
|
178
|
+
* document" identified by a media type. If the Request-URI does not
|
|
179
|
+
* point to an existing resource, the server MAY create a new resource,
|
|
180
|
+
* depending on the patch document type (whether it can logically modify
|
|
181
|
+
* a null resource) and permissions, etc.
|
|
182
|
+
*
|
|
183
|
+
* The difference between the PUT and PATCH requests is reflected in the
|
|
184
|
+
* way the server processes the enclosed entity to modify the resource
|
|
185
|
+
* identified by the Request-URI. In a PUT request, the enclosed entity
|
|
186
|
+
* is considered to be a modified version of the resource stored on the
|
|
187
|
+
* origin server, and the client is requesting that the stored version
|
|
188
|
+
* be replaced. With PATCH, however, the enclosed entity contains a set
|
|
189
|
+
* of instructions describing how a resource currently residing on the
|
|
190
|
+
* origin server should be modified to produce a new version. The PATCH
|
|
191
|
+
* method affects the resource identified by the Request-URI, and it
|
|
192
|
+
* also MAY have side effects on other resources; i.e., new resources
|
|
193
|
+
* may be created, or existing ones modified, by the application of a
|
|
194
|
+
* PATCH.
|
|
195
|
+
*
|
|
196
|
+
* PATCH is neither safe nor idempotent as defined by [RFC2616], Section
|
|
197
|
+
* 9.1.
|
|
198
|
+
*
|
|
199
|
+
* A PATCH request can be issued in such a way as to be idempotent,
|
|
200
|
+
* which also helps prevent bad outcomes from collisions between two
|
|
201
|
+
* PATCH requests on the same resource in a similar time frame.
|
|
202
|
+
* Collisions from multiple PATCH requests may be more dangerous than
|
|
203
|
+
* PUT collisions because some patch formats need to operate from a
|
|
204
|
+
* known base-point or else they will corrupt the resource. Clients
|
|
205
|
+
* using this kind of patch application SHOULD use a conditional request
|
|
206
|
+
* such that the request will fail if the resource has been updated
|
|
207
|
+
* since the client last accessed the resource. For example, the client
|
|
208
|
+
* can use a strong ETag [RFC2616] in an If-Match header on the PATCH
|
|
209
|
+
* request.
|
|
210
|
+
*
|
|
211
|
+
* There are also cases where patch formats do not need to operate from
|
|
212
|
+
* a known base-point (e.g., appending text lines to log files, or non-
|
|
213
|
+
* colliding rows to database tables), in which case the same care in
|
|
214
|
+
* client requests is not needed.
|
|
215
|
+
*
|
|
216
|
+
* The server MUST apply the entire set of changes atomically and never
|
|
217
|
+
* provide (e.g., in response to a GET during this operation) a
|
|
218
|
+
* partially modified representation. If the entire patch document
|
|
219
|
+
* cannot be successfully applied, then the server MUST NOT apply any of
|
|
220
|
+
* the changes. The determination of what constitutes a successful
|
|
221
|
+
* PATCH can vary depending on the patch document and the type of
|
|
222
|
+
* resource(s) being modified. For example, the common 'diff' utility
|
|
223
|
+
* can generate a patch document that applies to multiple files in a
|
|
224
|
+
* directory hierarchy. The atomicity requirement holds for all
|
|
225
|
+
* directly affected files. See "Error Handling", Section 2.2, for
|
|
226
|
+
* details on status codes and possible error conditions.
|
|
227
|
+
*
|
|
228
|
+
* If the request passes through a cache and the Request-URI identifies
|
|
229
|
+
* one or more currently cached entities, those entries SHOULD be
|
|
230
|
+
* treated as stale. A response to this method is only cacheable if it
|
|
231
|
+
* contains explicit freshness information (such as an Expires header or
|
|
232
|
+
* "Cache-Control: max-age" directive) as well as the Content-Location
|
|
233
|
+
* header matching the Request-URI, indicating that the PATCH response
|
|
234
|
+
* body is a resource representation. A cached PATCH response can only
|
|
235
|
+
* be used to respond to subsequent GET and HEAD requests; it MUST NOT
|
|
236
|
+
* be used to respond to other methods (in particular, PATCH).
|
|
237
|
+
*
|
|
238
|
+
* Note that entity-headers contained in the request apply only to the
|
|
239
|
+
* contained patch document and MUST NOT be applied to the resource
|
|
240
|
+
* being modified. Thus, a Content-Language header could be present on
|
|
241
|
+
* the request, but it would only mean (for whatever that's worth) that
|
|
242
|
+
* the patch document had a language. Servers SHOULD NOT store such
|
|
243
|
+
* headers except as trace information, and SHOULD NOT use such header
|
|
244
|
+
* values the same way they might be used on PUT requests. Therefore,
|
|
245
|
+
* this document does not specify a way to modify a document's Content-
|
|
246
|
+
* Type or Content-Language value through headers, though a mechanism
|
|
247
|
+
* could well be designed to achieve this goal through a patch document.
|
|
248
|
+
*
|
|
249
|
+
* There is no guarantee that a resource can be modified with PATCH.
|
|
250
|
+
* Further, it is expected that different patch document formats will be
|
|
251
|
+
* appropriate for different types of resources and that no single
|
|
252
|
+
* format will be appropriate for all types of resources. Therefore,
|
|
253
|
+
* there is no single default patch document format that implementations
|
|
254
|
+
* are required to support. Servers MUST ensure that a received patch
|
|
255
|
+
* document is appropriate for the type of resource identified by the
|
|
256
|
+
* Request-URI.
|
|
257
|
+
*
|
|
258
|
+
* Clients need to choose when to use PATCH rather than PUT. For
|
|
259
|
+
* example, if the patch document size is larger than the size of the
|
|
260
|
+
* new resource data that would be used in a PUT, then it might make
|
|
261
|
+
* sense to use PUT instead of PATCH. A comparison to POST is even more
|
|
262
|
+
* difficult, because POST is used in widely varying ways and can
|
|
263
|
+
* encompass PUT and PATCH-like operations if the server chooses. If
|
|
264
|
+
* the operation does not modify the resource identified by the Request-
|
|
265
|
+
* URI in a predictable way, POST should be considered instead of PATCH
|
|
266
|
+
* or PUT.
|
|
267
|
+
*/
|
|
268
|
+
PATCH: 'PATCH'
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export default HttpRequestMethod;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export default HttpResponseHeader;
|
|
2
|
+
declare namespace HttpResponseHeader {
|
|
3
|
+
const PROXY_CONNECTION: string;
|
|
4
|
+
const X_UIDH: string;
|
|
5
|
+
const X_CSRF_TOKEN: string;
|
|
6
|
+
const ACCESS_CONTROL_ALLOW_ORIGIN: string;
|
|
7
|
+
const ACCEPT_PATCH: string;
|
|
8
|
+
const ACCEPT_RANGES: string;
|
|
9
|
+
const AGE: string;
|
|
10
|
+
const ALLOW: string;
|
|
11
|
+
const CACHE_CONTROL: string;
|
|
12
|
+
const CONNECTION: string;
|
|
13
|
+
const CONTENT_DISPOSITION: string;
|
|
14
|
+
const CONTENT_ENCODING: string;
|
|
15
|
+
const CONTENT_LANGUAGE: string;
|
|
16
|
+
const CONTENT_LENGTH: string;
|
|
17
|
+
const CONTENT_LOCATION: string;
|
|
18
|
+
const CONTENT_RANGE: string;
|
|
19
|
+
const CONTENT_TYPE: string;
|
|
20
|
+
const DATE: string;
|
|
21
|
+
const ETAG: string;
|
|
22
|
+
const EXPIRES: string;
|
|
23
|
+
const LAST_MODIFIED: string;
|
|
24
|
+
const LINK: string;
|
|
25
|
+
const LOCATION: string;
|
|
26
|
+
const P3P: string;
|
|
27
|
+
const PRAGMA: string;
|
|
28
|
+
const PROXY_AUTHENTICATION: string;
|
|
29
|
+
const PUBLIC_KEY_PINS: string;
|
|
30
|
+
const RETRY_AFTER: string;
|
|
31
|
+
const SERVER: string;
|
|
32
|
+
const SET_COOKIE: string;
|
|
33
|
+
const STATUS: string;
|
|
34
|
+
const STRICT_TRANSPORT_SECURITY: string;
|
|
35
|
+
const TRAILER: string;
|
|
36
|
+
const TRANSFER_ENCODING: string;
|
|
37
|
+
const UPGRADE: string;
|
|
38
|
+
const VARY: string;
|
|
39
|
+
const VIA: string;
|
|
40
|
+
const WARNING: string;
|
|
41
|
+
const WWW_AUTHENTICATE: string;
|
|
42
|
+
const X_XSS_PROTECTION: string;
|
|
43
|
+
const CONTENT_SECURITY_POLICY: string;
|
|
44
|
+
const X_CONTENT_TYPE_OPTIONS: string;
|
|
45
|
+
const X_POWERED_BY: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
const HttpResponseHeader = {
|
|
2
|
+
/**
|
|
3
|
+
* Implemented as a misunderstanding of the HTTP specifications. Common because of mistakes in implementations of early HTTP versions. Has exactly the same functionality as standard Connection field.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* proxy-connection: keep-alive
|
|
7
|
+
*/
|
|
8
|
+
PROXY_CONNECTION: 'proxy-connection',
|
|
9
|
+
/**
|
|
10
|
+
* Server-side deep packet insertion of a unique ID identifying customers of Verizon Wireless, also known as "perma-cookie" or "supercookie"
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* x-uidh: ...
|
|
14
|
+
*/
|
|
15
|
+
X_UIDH: 'x-uidh',
|
|
16
|
+
/**
|
|
17
|
+
* Used to prevent cross-site request forgery. Alternative header names are: X-CSRFToken and X-XSRF-TOKEN
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* x-csrf-token: i8XNjC4b8KVok4uw5RftR38Wgp2BFwql
|
|
21
|
+
*/
|
|
22
|
+
X_CSRF_TOKEN: 'x-csrf-token',
|
|
23
|
+
/**
|
|
24
|
+
* Specifying which web sites can participate in cross-origin resource sharing
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* access-control-allow-origin: *
|
|
28
|
+
* Provisional
|
|
29
|
+
*/
|
|
30
|
+
ACCESS_CONTROL_ALLOW_ORIGIN: 'access-control-allow-origin',
|
|
31
|
+
/**
|
|
32
|
+
* Specifies which patch document formats this server supports
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* accept-patch: text/example,charset=utf-8
|
|
36
|
+
* Permanent
|
|
37
|
+
*/
|
|
38
|
+
ACCEPT_PATCH: 'accept-patch',
|
|
39
|
+
/**
|
|
40
|
+
* What partial content range types this server supports via byte serving
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* accept-ranges: bytes
|
|
44
|
+
* Permanent
|
|
45
|
+
*/
|
|
46
|
+
ACCEPT_RANGES: 'accept-ranges',
|
|
47
|
+
/**
|
|
48
|
+
* The age the object has been in a proxy cache in seconds
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* age: 12
|
|
52
|
+
* Permanent
|
|
53
|
+
*/
|
|
54
|
+
AGE: 'age',
|
|
55
|
+
/**
|
|
56
|
+
* Valid actions for a specified resource. To be used for a 405 Method not allowed
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* allow: GET, HEAD
|
|
60
|
+
* Permanent
|
|
61
|
+
*/
|
|
62
|
+
ALLOW: 'allow',
|
|
63
|
+
/**
|
|
64
|
+
* Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* cache-control: max-age=3600
|
|
68
|
+
* Permanent
|
|
69
|
+
*/
|
|
70
|
+
CACHE_CONTROL: 'cache-control',
|
|
71
|
+
/**
|
|
72
|
+
* Control options for the current connection and list of hop-by-hop response fields
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* connection: close
|
|
76
|
+
* Permanent
|
|
77
|
+
*/
|
|
78
|
+
CONNECTION: 'connection',
|
|
79
|
+
/**
|
|
80
|
+
* An opportunity to raise a "File Download" dialogue box for a known MIME type with binary format or suggest a filename for dynamic content. Quotes are necessary with special characters.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* content-disposition: attachment, filename="fname.ext"
|
|
84
|
+
* Permanent
|
|
85
|
+
*/
|
|
86
|
+
CONTENT_DISPOSITION: 'content-disposition',
|
|
87
|
+
/**
|
|
88
|
+
* The type of encoding used on the data. See HTTP compression.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* content-encoding: gzip
|
|
92
|
+
* Permanent
|
|
93
|
+
*/
|
|
94
|
+
CONTENT_ENCODING: 'content-encoding',
|
|
95
|
+
/**
|
|
96
|
+
* The natural language or languages of the intended audience for the enclosed content
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* content-language: da
|
|
100
|
+
* Permanent
|
|
101
|
+
*/
|
|
102
|
+
CONTENT_LANGUAGE: 'content-language',
|
|
103
|
+
/**
|
|
104
|
+
* The length of the response body in octets (8-bit bytes)
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* content-length: 348
|
|
108
|
+
* Permanent
|
|
109
|
+
*/
|
|
110
|
+
CONTENT_LENGTH: 'content-length',
|
|
111
|
+
/**
|
|
112
|
+
* An alternate location for the returned data
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* content-location: /index.htm
|
|
116
|
+
* Permanent
|
|
117
|
+
*/
|
|
118
|
+
CONTENT_LOCATION: 'content-location',
|
|
119
|
+
/**
|
|
120
|
+
* Where in a full body message this partial message belongs
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* content-range: bytes 21010-47021/47022
|
|
124
|
+
* Permanent
|
|
125
|
+
*/
|
|
126
|
+
CONTENT_RANGE: 'content-range',
|
|
127
|
+
/**
|
|
128
|
+
* The MIME type of this content
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* content-type: text/html, charset=utf-8
|
|
132
|
+
* Permanent
|
|
133
|
+
*/
|
|
134
|
+
CONTENT_TYPE: 'content-type',
|
|
135
|
+
/**
|
|
136
|
+
* The date and time that the message was sent (in "HTTP-date" format as defined by RFC 7231)
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* date: Tue, 15 Nov 1994 08:12:31 GMT
|
|
140
|
+
* Permanent
|
|
141
|
+
*/
|
|
142
|
+
DATE: 'date',
|
|
143
|
+
/**
|
|
144
|
+
* An identifier for a specific version of a resource, often a message digest
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* etag: "737060cd8c284d8af7ad3082f209582d"
|
|
148
|
+
* Permanent
|
|
149
|
+
*/
|
|
150
|
+
ETAG: 'etag',
|
|
151
|
+
/**
|
|
152
|
+
* Gives the date/time after which the response is considered stale (in "HTTP-date" format as defined by RFC 7231)
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* expires: Thu, 01 Dec 1994 16:00:00 GMT
|
|
156
|
+
* Permanent
|
|
157
|
+
*/
|
|
158
|
+
EXPIRES: 'expires',
|
|
159
|
+
/**
|
|
160
|
+
* The last modified date for the requested object (in "HTTP-date" format as defined by RFC 7231)
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* last-modified: Tue, 15 Nov 1994 12:45:26 GMT
|
|
164
|
+
* Permanent
|
|
165
|
+
*/
|
|
166
|
+
LAST_MODIFIED: 'last-modified',
|
|
167
|
+
/**
|
|
168
|
+
* Used to express a typed relationship with another resource, where the relation type is defined by RFC 5988
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* link: </feed>, rel="alternate"
|
|
172
|
+
* Permanent
|
|
173
|
+
*/
|
|
174
|
+
LINK: 'link',
|
|
175
|
+
/**
|
|
176
|
+
* Used in redirection, or when a new resource has been created.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* location: http://www.w3.org/pub/WWW/People.html
|
|
180
|
+
* Permanent
|
|
181
|
+
*/
|
|
182
|
+
LOCATION: 'location',
|
|
183
|
+
/**
|
|
184
|
+
* This field is supposed to set P3P policy, in the form of P3P:CP="your_compact_policy". However, P3P did not take off, most browsers have never fully
|
|
185
|
+
* implemented it, a lot of websites set this field with fake policy text, that was enough to fool browsers the existence of P3P policy and grant permissions for third party cookies.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* p3p: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
|
|
189
|
+
* Permanent
|
|
190
|
+
*/
|
|
191
|
+
P3P: 'p3p',
|
|
192
|
+
/**
|
|
193
|
+
* Implementation-specific fields that may have various effects anywhere along the request-response chain.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* pragma: no-cache
|
|
197
|
+
* Permanent
|
|
198
|
+
*/
|
|
199
|
+
PRAGMA: 'pragma',
|
|
200
|
+
/**
|
|
201
|
+
* Request authentication to access the proxy.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* proxy-authenticate: Basic
|
|
205
|
+
* Permanent
|
|
206
|
+
*/
|
|
207
|
+
PROXY_AUTHENTICATION: 'proxy-authenticate',
|
|
208
|
+
/**
|
|
209
|
+
* HTTP Public Key Pinning, announces hash of website's authentic TLS certificate
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* public-key-pins: max-age=2592000, pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=",
|
|
213
|
+
* Permanent
|
|
214
|
+
*/
|
|
215
|
+
PUBLIC_KEY_PINS: 'public-key-pins',
|
|
216
|
+
/**
|
|
217
|
+
* If an entity is temporarily unavailable, this instructs the client to try again later. Value could be a specified period of time (in seconds) or a HTTP-date.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* retry-after: 120
|
|
221
|
+
* retry-after: Fri, 07 Nov 2014 23:59:59 GMT
|
|
222
|
+
* Permanent
|
|
223
|
+
*/
|
|
224
|
+
RETRY_AFTER: 'retry-after',
|
|
225
|
+
/**
|
|
226
|
+
* A name for the server
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* server: Apache/2.4.1 (Unix)
|
|
230
|
+
* Permanent
|
|
231
|
+
*/
|
|
232
|
+
SERVER: 'server',
|
|
233
|
+
/**
|
|
234
|
+
* An HTTP cookie
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* set-cookie: UserID=JohnDoe, Max-Age=3600, Version=1
|
|
238
|
+
* Permanent
|
|
239
|
+
*/
|
|
240
|
+
SET_COOKIE: 'set-cookie',
|
|
241
|
+
/**
|
|
242
|
+
* CGI header field specifying the status of the HTTP response. Normal HTTP responses use a separate "Status-Line" instead, defined by RFC 7230.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* status: 200 OK
|
|
246
|
+
*/
|
|
247
|
+
STATUS: 'status',
|
|
248
|
+
/**
|
|
249
|
+
* A HSTS Policy informing the HTTP client how long to cache the HTTPS only policy and whether this applies to subdomains.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* strict-transport-security: max-age=16070400, includeSubDomains
|
|
253
|
+
* Permanent
|
|
254
|
+
*/
|
|
255
|
+
STRICT_TRANSPORT_SECURITY: 'strict-transport-security',
|
|
256
|
+
/**
|
|
257
|
+
* The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer coding.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* trailer: Max-Forwards
|
|
261
|
+
* Permanent
|
|
262
|
+
*/
|
|
263
|
+
TRAILER: 'trailer',
|
|
264
|
+
/**
|
|
265
|
+
* The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* transfer-encoding: chunked
|
|
269
|
+
* Permanent
|
|
270
|
+
*/
|
|
271
|
+
TRANSFER_ENCODING: 'transfer-encoding',
|
|
272
|
+
/**
|
|
273
|
+
* Ask the client to upgrade to another protocol.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
|
|
277
|
+
* Permanent
|
|
278
|
+
*/
|
|
279
|
+
UPGRADE: 'upgrade',
|
|
280
|
+
/**
|
|
281
|
+
* Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* vary: *
|
|
285
|
+
* Permanent
|
|
286
|
+
*/
|
|
287
|
+
VARY: 'vary',
|
|
288
|
+
/**
|
|
289
|
+
* Informs the client of proxies through which the response was sent.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* via: 1.0 fred, 1.1 example.com (Apache/1.1)
|
|
293
|
+
* Permanent
|
|
294
|
+
*/
|
|
295
|
+
VIA: 'via',
|
|
296
|
+
/**
|
|
297
|
+
* A general warning about possible problems with the entity body.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* warning: 199 Miscellaneous warning
|
|
301
|
+
* Permanent
|
|
302
|
+
*/
|
|
303
|
+
WARNING: 'warning',
|
|
304
|
+
/**
|
|
305
|
+
* Indicates the authentication scheme that should be used to access the requested entity.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* www-authenticate: Basic
|
|
309
|
+
* Permanent
|
|
310
|
+
*/
|
|
311
|
+
WWW_AUTHENTICATE: 'www-authenticate',
|
|
312
|
+
/**
|
|
313
|
+
* Cross-site scripting (XSS) filter
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* x-xss-protection: 1, mode=block
|
|
317
|
+
*/
|
|
318
|
+
X_XSS_PROTECTION: 'x-xss-protection',
|
|
319
|
+
/**
|
|
320
|
+
* The HTTP Content-Security-Policy response header allows web site administrators to control resources the user agent is allowed
|
|
321
|
+
* to load for a given page. With a few exceptions, policies mostly involve specifying server origins and script endpoints.
|
|
322
|
+
* This helps guard against cross-site scripting attacks (Cross-site_scripting).
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* content-security-policy: default-src
|
|
326
|
+
*/
|
|
327
|
+
CONTENT_SECURITY_POLICY: 'content-security-policy',
|
|
328
|
+
/**
|
|
329
|
+
* The only defined value, "nosniff", prevents Internet Explorer from MIME-sniffing a response away from the declared content-type. This also applies to Google Chrome, when downloading extensions.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* x-content-type-options: nosniff
|
|
333
|
+
*/
|
|
334
|
+
X_CONTENT_TYPE_OPTIONS: 'x-content-type-options',
|
|
335
|
+
/**
|
|
336
|
+
* specifies the technology (e.g. ASP.NET, PHP, JBoss) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version)
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* x-powered-by: PHP/5.4.0
|
|
340
|
+
*/
|
|
341
|
+
X_POWERED_BY: 'x-powered-by'
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
export default HttpResponseHeader;
|