@celljs/http 3.0.0
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 +1 -0
- package/cell.yml +6 -0
- package/lib/common/client/client-protocol.d.ts +9 -0
- package/lib/common/client/client-protocol.d.ts.map +1 -0
- package/lib/common/client/client-protocol.js +6 -0
- package/lib/common/client/client-protocol.js.map +1 -0
- package/lib/common/client/index.d.ts +3 -0
- package/lib/common/client/index.d.ts.map +1 -0
- package/lib/common/client/index.js +19 -0
- package/lib/common/client/index.js.map +1 -0
- package/lib/common/client/rest-operations-factory.d.ts +7 -0
- package/lib/common/client/rest-operations-factory.d.ts.map +1 -0
- package/lib/common/client/rest-operations-factory.js +29 -0
- package/lib/common/client/rest-operations-factory.js.map +1 -0
- package/lib/common/http/http-headers.d.ts +304 -0
- package/lib/common/http/http-headers.d.ts.map +1 -0
- package/lib/common/http/http-headers.js +308 -0
- package/lib/common/http/http-headers.js.map +1 -0
- package/lib/common/http/http-protocol.d.ts +156 -0
- package/lib/common/http/http-protocol.d.ts.map +1 -0
- package/lib/common/http/http-protocol.js +166 -0
- package/lib/common/http/http-protocol.js.map +1 -0
- package/lib/common/http/index.d.ts +3 -0
- package/lib/common/http/index.d.ts.map +1 -0
- package/lib/common/http/index.js +19 -0
- package/lib/common/http/index.js.map +1 -0
- package/lib/common/index.d.ts +3 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +19 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/module.d.ts +3 -0
- package/lib/common/module.d.ts.map +1 -0
- package/lib/common/module.js +11 -0
- package/lib/common/module.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +43 -0
- package/src/common/client/client-protocol.ts +12 -0
- package/src/common/client/index.ts +2 -0
- package/src/common/client/rest-operations-factory.ts +15 -0
- package/src/common/http/http-headers.ts +304 -0
- package/src/common/http/http-protocol.ts +169 -0
- package/src/common/http/index.ts +2 -0
- package/src/common/index.ts +2 -0
- package/src/common/module.ts +10 -0
- package/src/package.spec.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./http-protocol"), exports);
|
|
18
|
+
__exportStar(require("./http-headers"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/http/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./http"), exports);
|
|
18
|
+
__exportStar(require("./client"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/common/module.ts"],"names":[],"mappings":";AAGA,wBAMG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@celljs/core");
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
exports.default = (0, core_1.autoBind)(bind => {
|
|
6
|
+
bind(client_1.RestOperations).toDynamicValue(ctx => {
|
|
7
|
+
const factory = ctx.container.get(client_1.RestOperationsFactory);
|
|
8
|
+
return factory.create();
|
|
9
|
+
}).inSingletonScope();
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/common/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,qCAAiE;AAEjE,kBAAe,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE;IAC3B,IAAI,CAAC,uBAAc,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QACtC,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAwB,8BAAqB,CAAC,CAAC;QAChF,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAE1B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAE1B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@celljs/http",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/common/index.js",
|
|
6
|
+
"typings": "lib/common/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@celljs/core": "3.0.0",
|
|
9
|
+
"axios": "^0.26.1",
|
|
10
|
+
"rxjs": "^6.6.0"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cell-component"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/cellbang/cell.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/cellbang/cell/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/cellbang/cell",
|
|
27
|
+
"files": [
|
|
28
|
+
"lib",
|
|
29
|
+
"src",
|
|
30
|
+
"cell.yml"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"lint": "cell-component lint",
|
|
34
|
+
"build": "cell-component build",
|
|
35
|
+
"watch": "cell-component watch",
|
|
36
|
+
"clean": "cell-component clean",
|
|
37
|
+
"test": "cell-component test:js"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@celljs/component": "3.0.0"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "c0ef8d269e33a795406bcbb240cac4b845c6c24c"
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
export const RestOperations = Symbol('RestOperations');
|
|
4
|
+
export const RestOperationsFactory = Symbol('RestOperationsFactory');
|
|
5
|
+
|
|
6
|
+
export interface RestOperations extends AxiosInstance {
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RestOperationsFactory {
|
|
11
|
+
create(): RestOperations;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RestOperationsFactory, RestOperations } from './client-protocol';
|
|
2
|
+
import axios, { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { Component, Value } from '@celljs/core';
|
|
4
|
+
|
|
5
|
+
@Component(RestOperationsFactory)
|
|
6
|
+
export class DefaultRestOperationsFactory implements RestOperationsFactory {
|
|
7
|
+
|
|
8
|
+
@Value('cell.client.config')
|
|
9
|
+
protected readonly clientConfig: AxiosRequestConfig;
|
|
10
|
+
|
|
11
|
+
create(): RestOperations {
|
|
12
|
+
return axios.create(this.clientConfig);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
export class HttpHeaders {
|
|
2
|
+
/**
|
|
3
|
+
* The HTTP {@code Accept} header field name.
|
|
4
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.2">Section 5.3.2 of RFC 7231</a>
|
|
5
|
+
*/
|
|
6
|
+
public static ACCEPT = 'Accept';
|
|
7
|
+
/**
|
|
8
|
+
* The HTTP {@code Accept-Charset} header field name.
|
|
9
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.3">Section 5.3.3 of RFC 7231</a>
|
|
10
|
+
*/
|
|
11
|
+
public static ACCEPT_CHARSET = 'Accept-Charset';
|
|
12
|
+
/**
|
|
13
|
+
* The HTTP {@code Accept-Encoding} header field name.
|
|
14
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.4">Section 5.3.4 of RFC 7231</a>
|
|
15
|
+
*/
|
|
16
|
+
public static ACCEPT_ENCODING = 'Accept-Encoding';
|
|
17
|
+
/**
|
|
18
|
+
* The HTTP {@code Accept-Language} header field name.
|
|
19
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.5">Section 5.3.5 of RFC 7231</a>
|
|
20
|
+
*/
|
|
21
|
+
public static ACCEPT_LANGUAGE = 'Accept-Language';
|
|
22
|
+
/**
|
|
23
|
+
* The HTTP {@code Accept-Ranges} header field name.
|
|
24
|
+
* @see <a href="https://tools.ietf.org/html/rfc7233#section-2.3">Section 5.3.5 of RFC 7233</a>
|
|
25
|
+
*/
|
|
26
|
+
public static ACCEPT_RANGES = 'Accept-Ranges';
|
|
27
|
+
/**
|
|
28
|
+
* The CORS {@code Access-Control-Allow-Credentials} response header field name.
|
|
29
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
30
|
+
*/
|
|
31
|
+
public static ACCESS_CONTROL_ALLOW_CREDENTIALS = 'Access-Control-Allow-Credentials';
|
|
32
|
+
/**
|
|
33
|
+
* The CORS {@code Access-Control-Allow-Headers} response header field name.
|
|
34
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
35
|
+
*/
|
|
36
|
+
public static ACCESS_CONTROL_ALLOW_HEADERS = 'Access-Control-Allow-Headers';
|
|
37
|
+
/**
|
|
38
|
+
* The CORS {@code Access-Control-Allow-Methods} response header field name.
|
|
39
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
40
|
+
*/
|
|
41
|
+
public static ACCESS_CONTROL_ALLOW_METHODS = 'Access-Control-Allow-Methods';
|
|
42
|
+
/**
|
|
43
|
+
* The CORS {@code Access-Control-Allow-Origin} response header field name.
|
|
44
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
45
|
+
*/
|
|
46
|
+
public static ACCESS_CONTROL_ALLOW_ORIGIN = 'Access-Control-Allow-Origin';
|
|
47
|
+
/**
|
|
48
|
+
* The CORS {@code Access-Control-Expose-Headers} response header field name.
|
|
49
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
50
|
+
*/
|
|
51
|
+
public static ACCESS_CONTROL_EXPOSE_HEADERS = 'Access-Control-Expose-Headers';
|
|
52
|
+
/**
|
|
53
|
+
* The CORS {@code Access-Control-Max-Age} response header field name.
|
|
54
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
55
|
+
*/
|
|
56
|
+
public static ACCESS_CONTROL_MAX_AGE = 'Access-Control-Max-Age';
|
|
57
|
+
/**
|
|
58
|
+
* The CORS {@code Access-Control-Request-Headers} request header field name.
|
|
59
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
60
|
+
*/
|
|
61
|
+
public static ACCESS_CONTROL_REQUEST_HEADERS = 'Access-Control-Request-Headers';
|
|
62
|
+
/**
|
|
63
|
+
* The CORS {@code Access-Control-Request-Method} request header field name.
|
|
64
|
+
* @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>
|
|
65
|
+
*/
|
|
66
|
+
public static ACCESS_CONTROL_REQUEST_METHOD = 'Access-Control-Request-Method';
|
|
67
|
+
/**
|
|
68
|
+
* The HTTP {@code Age} header field name.
|
|
69
|
+
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.1">Section 5.1 of RFC 7234</a>
|
|
70
|
+
*/
|
|
71
|
+
public static AGE = 'Age';
|
|
72
|
+
/**
|
|
73
|
+
* The HTTP {@code Allow} header field name.
|
|
74
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.4.1">Section 7.4.1 of RFC 7231</a>
|
|
75
|
+
*/
|
|
76
|
+
public static ALLOW = 'Allow';
|
|
77
|
+
/**
|
|
78
|
+
* The HTTP {@code Authorization} header field name.
|
|
79
|
+
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.2">Section 4.2 of RFC 7235</a>
|
|
80
|
+
*/
|
|
81
|
+
public static AUTHORIZATION = 'Authorization';
|
|
82
|
+
/**
|
|
83
|
+
* The HTTP {@code Cache-Control} header field name.
|
|
84
|
+
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2">Section 5.2 of RFC 7234</a>
|
|
85
|
+
*/
|
|
86
|
+
public static CACHE_CONTROL = 'Cache-Control';
|
|
87
|
+
/**
|
|
88
|
+
* The HTTP {@code Connection} header field name.
|
|
89
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-6.1">Section 6.1 of RFC 7230</a>
|
|
90
|
+
*/
|
|
91
|
+
public static CONNECTION = 'Connection';
|
|
92
|
+
/**
|
|
93
|
+
* The HTTP {@code Content-Encoding} header field name.
|
|
94
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.2.2">Section 3.1.2.2 of RFC 7231</a>
|
|
95
|
+
*/
|
|
96
|
+
public static CONTENT_ENCODING = 'Content-Encoding';
|
|
97
|
+
/**
|
|
98
|
+
* The HTTP {@code Content-Disposition} header field name.
|
|
99
|
+
* @see <a href="https://tools.ietf.org/html/rfc6266">RFC 6266</a>
|
|
100
|
+
*/
|
|
101
|
+
public static CONTENT_DISPOSITION = 'Content-Disposition';
|
|
102
|
+
/**
|
|
103
|
+
* The HTTP {@code Content-Language} header field name.
|
|
104
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.3.2">Section 3.1.3.2 of RFC 7231</a>
|
|
105
|
+
*/
|
|
106
|
+
public static CONTENT_LANGUAGE = 'Content-Language';
|
|
107
|
+
/**
|
|
108
|
+
* The HTTP {@code Content-Length} header field name.
|
|
109
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-3.3.2">Section 3.3.2 of RFC 7230</a>
|
|
110
|
+
*/
|
|
111
|
+
public static CONTENT_LENGTH = 'Content-Length';
|
|
112
|
+
/**
|
|
113
|
+
* The HTTP {@code Content-Location} header field name.
|
|
114
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.4.2">Section 3.1.4.2 of RFC 7231</a>
|
|
115
|
+
*/
|
|
116
|
+
public static CONTENT_LOCATION = 'Content-Location';
|
|
117
|
+
/**
|
|
118
|
+
* The HTTP {@code Content-Range} header field name.
|
|
119
|
+
* @see <a href="https://tools.ietf.org/html/rfc7233#section-4.2">Section 4.2 of RFC 7233</a>
|
|
120
|
+
*/
|
|
121
|
+
public static CONTENT_RANGE = 'Content-Range';
|
|
122
|
+
/**
|
|
123
|
+
* The HTTP {@code Content-Type} header field name.
|
|
124
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.1.5">Section 3.1.1.5 of RFC 7231</a>
|
|
125
|
+
*/
|
|
126
|
+
public static CONTENT_TYPE = 'Content-Type';
|
|
127
|
+
/**
|
|
128
|
+
* The HTTP {@code Cookie} header field name.
|
|
129
|
+
* @see <a href="https://tools.ietf.org/html/rfc2109#section-4.3.4">Section 4.3.4 of RFC 2109</a>
|
|
130
|
+
*/
|
|
131
|
+
public static COOKIE = 'Cookie';
|
|
132
|
+
/**
|
|
133
|
+
* The HTTP {@code Date} header field name.
|
|
134
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.2">Section 7.1.1.2 of RFC 7231</a>
|
|
135
|
+
*/
|
|
136
|
+
public static DATE = 'Date';
|
|
137
|
+
/**
|
|
138
|
+
* The HTTP {@code ETag} header field name.
|
|
139
|
+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.3">Section 2.3 of RFC 7232</a>
|
|
140
|
+
*/
|
|
141
|
+
public static ETAG = 'ETag';
|
|
142
|
+
/**
|
|
143
|
+
* The HTTP {@code Expect} header field name.
|
|
144
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.1.1">Section 5.1.1 of RFC 7231</a>
|
|
145
|
+
*/
|
|
146
|
+
public static EXPECT = 'Expect';
|
|
147
|
+
/**
|
|
148
|
+
* The HTTP {@code Expires} header field name.
|
|
149
|
+
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.3">Section 5.3 of RFC 7234</a>
|
|
150
|
+
*/
|
|
151
|
+
public static EXPIRES = 'Expires';
|
|
152
|
+
/**
|
|
153
|
+
* The HTTP {@code From} header field name.
|
|
154
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.5.1">Section 5.5.1 of RFC 7231</a>
|
|
155
|
+
*/
|
|
156
|
+
public static FROM = 'From';
|
|
157
|
+
/**
|
|
158
|
+
* The HTTP {@code Host} header field name.
|
|
159
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-5.4">Section 5.4 of RFC 7230</a>
|
|
160
|
+
*/
|
|
161
|
+
public static HOST = 'Host';
|
|
162
|
+
/**
|
|
163
|
+
* The HTTP {@code If-Match} header field name.
|
|
164
|
+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.1">Section 3.1 of RFC 7232</a>
|
|
165
|
+
*/
|
|
166
|
+
public static IF_MATCH = 'If-Match';
|
|
167
|
+
/**
|
|
168
|
+
* The HTTP {@code If-Modified-Since} header field name.
|
|
169
|
+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.3">Section 3.3 of RFC 7232</a>
|
|
170
|
+
*/
|
|
171
|
+
public static IF_MODIFIED_SINCE = 'If-Modified-Since';
|
|
172
|
+
/**
|
|
173
|
+
* The HTTP {@code If-None-Match} header field name.
|
|
174
|
+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.2">Section 3.2 of RFC 7232</a>
|
|
175
|
+
*/
|
|
176
|
+
public static IF_NONE_MATCH = 'If-None-Match';
|
|
177
|
+
/**
|
|
178
|
+
* The HTTP {@code If-Range} header field name.
|
|
179
|
+
* @see <a href="https://tools.ietf.org/html/rfc7233#section-3.2">Section 3.2 of RFC 7233</a>
|
|
180
|
+
*/
|
|
181
|
+
public static IF_RANGE = 'If-Range';
|
|
182
|
+
/**
|
|
183
|
+
* The HTTP {@code If-Unmodified-Since} header field name.
|
|
184
|
+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.4">Section 3.4 of RFC 7232</a>
|
|
185
|
+
*/
|
|
186
|
+
public static IF_UNMODIFIED_SINCE = 'If-Unmodified-Since';
|
|
187
|
+
/**
|
|
188
|
+
* The HTTP {@code Last-Modified} header field name.
|
|
189
|
+
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.2">Section 2.2 of RFC 7232</a>
|
|
190
|
+
*/
|
|
191
|
+
public static LAST_MODIFIED = 'Last-Modified';
|
|
192
|
+
/**
|
|
193
|
+
* The HTTP {@code Link} header field name.
|
|
194
|
+
* @see <a href="https://tools.ietf.org/html/rfc5988">RFC 5988</a>
|
|
195
|
+
*/
|
|
196
|
+
public static LINK = 'Link';
|
|
197
|
+
/**
|
|
198
|
+
* The HTTP {@code Location} header field name.
|
|
199
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.2">Section 7.1.2 of RFC 7231</a>
|
|
200
|
+
*/
|
|
201
|
+
public static LOCATION = 'Location';
|
|
202
|
+
/**
|
|
203
|
+
* The HTTP {@code Max-Forwards} header field name.
|
|
204
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.1.2">Section 5.1.2 of RFC 7231</a>
|
|
205
|
+
*/
|
|
206
|
+
public static MAX_FORWARDS = 'Max-Forwards';
|
|
207
|
+
/**
|
|
208
|
+
* The HTTP {@code Origin} header field name.
|
|
209
|
+
* @see <a href="https://tools.ietf.org/html/rfc6454">RFC 6454</a>
|
|
210
|
+
*/
|
|
211
|
+
public static ORIGIN = 'Origin';
|
|
212
|
+
/**
|
|
213
|
+
* The HTTP {@code Pragma} header field name.
|
|
214
|
+
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.4">Section 5.4 of RFC 7234</a>
|
|
215
|
+
*/
|
|
216
|
+
public static PRAGMA = 'Pragma';
|
|
217
|
+
/**
|
|
218
|
+
* The HTTP {@code Proxy-Authenticate} header field name.
|
|
219
|
+
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.3">Section 4.3 of RFC 7235</a>
|
|
220
|
+
*/
|
|
221
|
+
public static PROXY_AUTHENTICATE = 'Proxy-Authenticate';
|
|
222
|
+
/**
|
|
223
|
+
* The HTTP {@code Proxy-Authorization} header field name.
|
|
224
|
+
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.4">Section 4.4 of RFC 7235</a>
|
|
225
|
+
*/
|
|
226
|
+
public static PROXY_AUTHORIZATION = 'Proxy-Authorization';
|
|
227
|
+
/**
|
|
228
|
+
* The HTTP {@code Range} header field name.
|
|
229
|
+
* @see <a href="https://tools.ietf.org/html/rfc7233#section-3.1">Section 3.1 of RFC 7233</a>
|
|
230
|
+
*/
|
|
231
|
+
public static RANGE = 'Range';
|
|
232
|
+
/**
|
|
233
|
+
* The HTTP {@code Referer} header field name.
|
|
234
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.5.2">Section 5.5.2 of RFC 7231</a>
|
|
235
|
+
*/
|
|
236
|
+
public static REFERER = 'Referer';
|
|
237
|
+
/**
|
|
238
|
+
* The HTTP {@code Retry-After} header field name.
|
|
239
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.3">Section 7.1.3 of RFC 7231</a>
|
|
240
|
+
*/
|
|
241
|
+
public static RETRY_AFTER = 'Retry-After';
|
|
242
|
+
/**
|
|
243
|
+
* The HTTP {@code Server} header field name.
|
|
244
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.4.2">Section 7.4.2 of RFC 7231</a>
|
|
245
|
+
*/
|
|
246
|
+
public static SERVER = 'Server';
|
|
247
|
+
/**
|
|
248
|
+
* The HTTP {@code Set-Cookie} header field name.
|
|
249
|
+
* @see <a href="https://tools.ietf.org/html/rfc2109#section-4.2.2">Section 4.2.2 of RFC 2109</a>
|
|
250
|
+
*/
|
|
251
|
+
public static SET_COOKIE = 'Set-Cookie';
|
|
252
|
+
/**
|
|
253
|
+
* The HTTP {@code Set-Cookie2} header field name.
|
|
254
|
+
* @see <a href="https://tools.ietf.org/html/rfc2965">RFC 2965</a>
|
|
255
|
+
*/
|
|
256
|
+
public static SET_COOKIE2 = 'Set-Cookie2';
|
|
257
|
+
/**
|
|
258
|
+
* The HTTP {@code TE} header field name.
|
|
259
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-4.3">Section 4.3 of RFC 7230</a>
|
|
260
|
+
*/
|
|
261
|
+
public static TE = 'TE';
|
|
262
|
+
/**
|
|
263
|
+
* The HTTP {@code Trailer} header field name.
|
|
264
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-4.4">Section 4.4 of RFC 7230</a>
|
|
265
|
+
*/
|
|
266
|
+
public static TRAILER = 'Trailer';
|
|
267
|
+
/**
|
|
268
|
+
* The HTTP {@code Transfer-Encoding} header field name.
|
|
269
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-3.3.1">Section 3.3.1 of RFC 7230</a>
|
|
270
|
+
*/
|
|
271
|
+
public static TRANSFER_ENCODING = 'Transfer-Encoding';
|
|
272
|
+
/**
|
|
273
|
+
* The HTTP {@code Upgrade} header field name.
|
|
274
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-6.7">Section 6.7 of RFC 7230</a>
|
|
275
|
+
*/
|
|
276
|
+
public static UPGRADE = 'Upgrade';
|
|
277
|
+
/**
|
|
278
|
+
* The HTTP {@code User-Agent} header field name.
|
|
279
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.5.3">Section 5.5.3 of RFC 7231</a>
|
|
280
|
+
*/
|
|
281
|
+
public static USER_AGENT = 'User-Agent';
|
|
282
|
+
/**
|
|
283
|
+
* The HTTP {@code Vary} header field name.
|
|
284
|
+
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.4">Section 7.1.4 of RFC 7231</a>
|
|
285
|
+
*/
|
|
286
|
+
public static VARY = 'Vary';
|
|
287
|
+
/**
|
|
288
|
+
* The HTTP {@code Via} header field name.
|
|
289
|
+
* @see <a href="https://tools.ietf.org/html/rfc7230#section-5.7.1">Section 5.7.1 of RFC 7230</a>
|
|
290
|
+
*/
|
|
291
|
+
public static VIA = 'Via';
|
|
292
|
+
/**
|
|
293
|
+
* The HTTP {@code Warning} header field name.
|
|
294
|
+
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.5">Section 5.5 of RFC 7234</a>
|
|
295
|
+
*/
|
|
296
|
+
public static WARNING = 'Warning';
|
|
297
|
+
/**
|
|
298
|
+
* The HTTP {@code WWW-Authenticate} header field name.
|
|
299
|
+
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.1">Section 4.1 of RFC 7235</a>
|
|
300
|
+
*/
|
|
301
|
+
public static WWW_AUTHENTICATE = 'WWW-Authenticate';
|
|
302
|
+
|
|
303
|
+
public static X_REQUESTED_WITH = 'X-Requested-With';
|
|
304
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export enum HttpStatus {
|
|
2
|
+
CONTINUE = 100,
|
|
3
|
+
SWITCHING_PROTOCOLS = 101,
|
|
4
|
+
PROCESSING = 102,
|
|
5
|
+
OK = 200,
|
|
6
|
+
CREATED = 201,
|
|
7
|
+
ACCEPTED = 202,
|
|
8
|
+
NON_AUTHORITATIVE_INFORMATION = 203,
|
|
9
|
+
NO_CONTENT = 204,
|
|
10
|
+
RESET_CONTENT = 205,
|
|
11
|
+
PARTIAL_CONTENT = 206,
|
|
12
|
+
AMBIGUOUS = 300,
|
|
13
|
+
MOVED_PERMANENTLY = 301,
|
|
14
|
+
FOUND = 302,
|
|
15
|
+
SEE_OTHER = 303,
|
|
16
|
+
NOT_MODIFIED = 304,
|
|
17
|
+
TEMPORARY_REDIRECT = 307,
|
|
18
|
+
PERMANENT_REDIRECT = 308,
|
|
19
|
+
BAD_REQUEST = 400,
|
|
20
|
+
UNAUTHORIZED = 401,
|
|
21
|
+
PAYMENT_REQUIRED = 402,
|
|
22
|
+
FORBIDDEN = 403,
|
|
23
|
+
NOT_FOUND = 404,
|
|
24
|
+
METHOD_NOT_ALLOWED = 405,
|
|
25
|
+
NOT_ACCEPTABLE = 406,
|
|
26
|
+
PROXY_AUTHENTICATION_REQUIRED = 407,
|
|
27
|
+
REQUEST_TIMEOUT = 408,
|
|
28
|
+
CONFLICT = 409,
|
|
29
|
+
GONE = 410,
|
|
30
|
+
LENGTH_REQUIRED = 411,
|
|
31
|
+
PRECONDITION_FAILED = 412,
|
|
32
|
+
PAYLOAD_TOO_LARGE = 413,
|
|
33
|
+
URI_TOO_LONG = 414,
|
|
34
|
+
UNSUPPORTED_MEDIA_TYPE = 415,
|
|
35
|
+
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
|
36
|
+
EXPECTATION_FAILED = 417,
|
|
37
|
+
I_AM_A_TEAPOT = 418,
|
|
38
|
+
UNPROCESSABLE_ENTITY = 422,
|
|
39
|
+
FAILED_DEPENDENCY = 424,
|
|
40
|
+
TOO_MANY_REQUESTS = 429,
|
|
41
|
+
INTERNAL_SERVER_ERROR = 500,
|
|
42
|
+
NOT_IMPLEMENTED = 501,
|
|
43
|
+
BAD_GATEWAY = 502,
|
|
44
|
+
SERVICE_UNAVAILABLE = 503,
|
|
45
|
+
GATEWAY_TIMEOUT = 504,
|
|
46
|
+
HTTP_VERSION_NOT_SUPPORTED = 505,
|
|
47
|
+
VARIANT_ALSO_NEGOTIATES = 506,
|
|
48
|
+
INSUFFICIENT_STORAGE = 507,
|
|
49
|
+
LOOP_DETECTED = 508,
|
|
50
|
+
BANDWIDTH_LIMIT_EXCEEDED = 509,
|
|
51
|
+
NOT_EXTENDED = 510,
|
|
52
|
+
NETWORK_AUTHENTICATION_REQUIRED = 511,
|
|
53
|
+
|
|
54
|
+
CONTINUE_REASON_PHRASE = 'Continue',
|
|
55
|
+
SWITCHING_PROTOCOLS_REASON_PHRASE = 'Switching Protocols',
|
|
56
|
+
PROCESSING_REASON_PHRASE = 'Processing',
|
|
57
|
+
CHECKPOINT_REASON_PHRASE = 'Checkpoint',
|
|
58
|
+
|
|
59
|
+
// 2xx Success
|
|
60
|
+
OK_REASON_PHRASE = 'OK',
|
|
61
|
+
CREATED_REASON_PHRASE = 'Created',
|
|
62
|
+
ACCEPTED_REASON_PHRASE = 'Accepted',
|
|
63
|
+
NON_AUTHORITATIVE_INFORMATION_REASON_PHRASE = 'Non-Authoritative Information',
|
|
64
|
+
NO_CONTENT_REASON_PHRASE = 'No Content',
|
|
65
|
+
RESET_CONTENT_REASON_PHRASE = 'Reset Content',
|
|
66
|
+
PARTIAL_CONTENT_REASON_PHRASE = 'Partial Content',
|
|
67
|
+
MULTI_STATUS_REASON_PHRASE = 'Multi-Status',
|
|
68
|
+
ALREADY_REPORTED_REASON_PHRASE = 'Already Reported',
|
|
69
|
+
IM_USED_REASON_PHRASE = 'IM Used',
|
|
70
|
+
|
|
71
|
+
// 3xx Redirection
|
|
72
|
+
MULTIPLE_CHOICES_REASON_PHRASE = 'Multiple Choices',
|
|
73
|
+
MOVED_PERMANENTLY_REASON_PHRASE = 'Moved Permanently',
|
|
74
|
+
FOUND_REASON_PHRASE = 'Found',
|
|
75
|
+
MOVED_TEMPORARILY_REASON_PHRASE = 'Moved Temporarily',
|
|
76
|
+
SEE_OTHER_REASON_PHRASE = 'See Other',
|
|
77
|
+
NOT_MODIFIED_REASON_PHRASE = 'Not Modified',
|
|
78
|
+
USE_PROXY_REASON_PHRASE = 'Use Proxy',
|
|
79
|
+
TEMPORARY_REDIRECT_REASON_PHRASE = 'Temporary Redirect',
|
|
80
|
+
PERMANENT_REDIRECT_REASON_PHRASE = 'Permanent Redirect',
|
|
81
|
+
|
|
82
|
+
// --- 4xx Client Error ---
|
|
83
|
+
BAD_REQUEST_REASON_PHRASE = 'Bad Request',
|
|
84
|
+
UNAUTHORIZED_REASON_PHRASE = 'Unauthorized',
|
|
85
|
+
PAYMENT_REQUIRED_REASON_PHRASE = 'Payment Required',
|
|
86
|
+
FORBIDDEN_REASON_PHRASE = 'Forbidden',
|
|
87
|
+
NOT_FOUND_REASON_PHRASE = 'Not Found',
|
|
88
|
+
METHOD_NOT_ALLOWED_REASON_PHRASE = 'Method Not Allowed',
|
|
89
|
+
NOT_ACCEPTABLE_REASON_PHRASE = 'Not Acceptable',
|
|
90
|
+
PROXY_AUTHENTICATION_REQUIRED_REASON_PHRASE = 'Proxy Authentication Required',
|
|
91
|
+
REQUEST_TIMEOUT_REASON_PHRASE = 'Request Timeout',
|
|
92
|
+
CONFLICT_REASON_PHRASE = 'Conflict',
|
|
93
|
+
GONE_REASON_PHRASE = 'Gone',
|
|
94
|
+
LENGTH_REQUIRED_REASON_PHRASE = 'Length Required',
|
|
95
|
+
PRECONDITION_FAILED_REASON_PHRASE = 'Precondition Failed',
|
|
96
|
+
PAYLOAD_TOO_LARGE_REASON_PHRASE = 'Payload Too Large',
|
|
97
|
+
REQUEST_ENTITY_TOO_LARGE_REASON_PHRASE = 'Request Entity Too Large',
|
|
98
|
+
URI_TOO_LONG_REASON_PHRASE = 'URI Too Long',
|
|
99
|
+
REQUEST_URI_TOO_LONG_REASON_PHRASE = 'Request-URI Too Long',
|
|
100
|
+
UNSUPPORTED_MEDIA_TYPE_REASON_PHRASE = 'Unsupported Media Type',
|
|
101
|
+
REQUESTED_RANGE_NOT_SATISFIABLE_REASON_PHRASE = 'Requested range not satisfiable',
|
|
102
|
+
EXPECTATION_FAILED_REASON_PHRASE = 'Expectation Failed',
|
|
103
|
+
I_AM_A_TEAPOT_REASON_PHRASE = 'I\'m a teapot',
|
|
104
|
+
INSUFFICIENT_SPACE_ON_RESOURCE_REASON_PHRASE = 'Insufficient Space On Resource',
|
|
105
|
+
METHOD_FAILURE_REASON_PHRASE = 'Method Failure',
|
|
106
|
+
DESTINATION_LOCKED_REASON_PHRASE = 'Destination Locked',
|
|
107
|
+
UNPROCESSABLE_ENTITY_REASON_PHRASE = 'Unprocessable Entity',
|
|
108
|
+
LOCKED_REASON_PHRASE = 'Locked',
|
|
109
|
+
FAILED_DEPENDENCY_REASON_PHRASE = 'Failed Dependency',
|
|
110
|
+
UPGRADE_REQUIRED_REASON_PHRASE = 'Upgrade Required',
|
|
111
|
+
PRECONDITION_REQUIRED_REASON_PHRASE = 'Precondition Required',
|
|
112
|
+
TOO_MANY_REQUESTS_REASON_PHRASE = 'Too Many Requests',
|
|
113
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE_REASON_PHRASE = 'Request Header Fields Too Large',
|
|
114
|
+
UNAVAILABLE_FOR_LEGAL_REASONS_REASON_PHRASE = 'Unavailable For Legal Reasons',
|
|
115
|
+
|
|
116
|
+
// --- 5xx Server Error ---
|
|
117
|
+
INTERNAL_SERVER_ERROR_REASON_PHRASE = 'Internal Server Error',
|
|
118
|
+
NOT_IMPLEMENTED_REASON_PHRASE = 'Not Implemented',
|
|
119
|
+
BAD_GATEWAY_REASON_PHRASE = 'Bad Gateway',
|
|
120
|
+
SERVICE_UNAVAILABLE_REASON_PHRASE = 'Service Unavailable',
|
|
121
|
+
GATEWAY_TIMEOUT_REASON_PHRASE = 'Gateway Timeout',
|
|
122
|
+
HTTP_VERSION_NOT_SUPPORTED_REASON_PHRASE = 'HTTP Version not supported',
|
|
123
|
+
VARIANT_ALSO_NEGOTIATES_REASON_PHRASE = 'Variant Also Negotiates',
|
|
124
|
+
INSUFFICIENT_STORAGE_REASON_PHRASE = 'Insufficient Storage',
|
|
125
|
+
LOOP_DETECTED_REASON_PHRASE = 'Loop Detected',
|
|
126
|
+
BANDWIDTH_LIMIT_EXCEEDED_REASON_PHRASE = 'Bandwidth Limit Exceeded',
|
|
127
|
+
NOT_EXTENDED_REASON_PHRASE = 'Not Extended',
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export enum MediaType {
|
|
131
|
+
|
|
132
|
+
ALL = '*/*',
|
|
133
|
+
APPLICATION_ATOM_XML = 'application/atom+xml',
|
|
134
|
+
APPLICATION_FORM_URLENCODED = 'application/x-www-form-urlencoded',
|
|
135
|
+
APPLICATION_JSON = 'application/json',
|
|
136
|
+
APPLICATION_JSON_UTF8 = 'application/json;charset=UTF-8',
|
|
137
|
+
APPLICATION_OCTET_STREAM = 'application/octet-stream',
|
|
138
|
+
APPLICATION_PDF = 'application/pdf',
|
|
139
|
+
APPLICATION_PROBLEM_JSON = 'application/problem+json',
|
|
140
|
+
APPLICATION_PROBLEM_JSON_UTF8 = 'application/problem+json;charset=UTF-8',
|
|
141
|
+
APPLICATION_PROBLEM_XML = 'application/problem+xml',
|
|
142
|
+
APPLICATION_RSS_XML = 'application/rss+xml',
|
|
143
|
+
APPLICATION_STREAM_JSON = 'application/stream+json',
|
|
144
|
+
APPLICATION_XHTML_XML = 'application/xhtml+xml',
|
|
145
|
+
APPLICATION_XML = 'application/xml',
|
|
146
|
+
IMAGE_GIF = 'image/gif',
|
|
147
|
+
IMAGE_JPEG = 'image/jpeg',
|
|
148
|
+
IMAGE_PNG = 'image/png',
|
|
149
|
+
MULTIPART_FORM_DATA = 'multipart/form-data',
|
|
150
|
+
TEXT_EVENT_STREAM = 'text/event-stream',
|
|
151
|
+
TEXT_HTML = 'text/html',
|
|
152
|
+
TEXT_MARKDOWN = 'text/markdown',
|
|
153
|
+
TEXT_PLAIN = 'text/plain',
|
|
154
|
+
TEXT_XML = 'text/xml'
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export enum HttpMethod {
|
|
158
|
+
|
|
159
|
+
GET = 'GET',
|
|
160
|
+
HEAD = 'HEAD',
|
|
161
|
+
POST = 'POST',
|
|
162
|
+
PUT = 'PUT',
|
|
163
|
+
PATCH = 'PATCH',
|
|
164
|
+
DELETE = 'DELETE',
|
|
165
|
+
OPTIONS = 'OPTIONS',
|
|
166
|
+
TRACE = 'TRACE'
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const XML_HTTP_REQUEST = 'XMLHttpRequest';
|