@utiliread/http 1.17.7 → 1.18.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/.vscode/settings.json +2 -2
- package/dist/cjs/event-aggregator.js +29 -29
- package/dist/cjs/event-aggregator.js.map +1 -1
- package/dist/cjs/events.js +18 -18
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/helpers.js +15 -15
- package/dist/cjs/http-builder.js +191 -191
- package/dist/cjs/http-builder.js.map +1 -1
- package/dist/cjs/http-error.js +29 -29
- package/dist/cjs/http-error.js.map +1 -1
- package/dist/cjs/http-response.js +50 -50
- package/dist/cjs/http-response.js.map +1 -1
- package/dist/cjs/http.js +95 -95
- package/dist/cjs/http.js.map +1 -1
- package/dist/cjs/http.spec.js +68 -68
- package/dist/cjs/http.spec.js.map +1 -1
- package/dist/cjs/index.js +37 -37
- package/dist/cjs/json/index.js +73 -73
- package/dist/cjs/jsonpatch/index.js +14 -14
- package/dist/cjs/mapping.js +36 -36
- package/dist/cjs/mapping.js.map +1 -1
- package/dist/cjs/msgpack/index.js +34 -34
- package/dist/cjs/msgpack/index.js.map +1 -1
- package/dist/cjs/pagination.js +2 -2
- package/dist/cjs/problem-details.js +2 -2
- package/dist/cjs/query-string.js +67 -65
- package/dist/cjs/query-string.js.map +1 -1
- package/dist/cjs/query-string.spec.js +51 -51
- package/dist/cjs/status-codes.js +70 -70
- package/dist/cjs/timeout-error.js +13 -13
- package/dist/esm/event-aggregator.d.ts +11 -11
- package/dist/esm/event-aggregator.js +25 -25
- package/dist/esm/event-aggregator.js.map +1 -1
- package/dist/esm/events.d.ts +11 -11
- package/dist/esm/events.js +14 -14
- package/dist/esm/events.js.map +1 -1
- package/dist/esm/helpers.d.ts +5 -5
- package/dist/esm/helpers.js +9 -9
- package/dist/esm/http-builder.d.ts +60 -60
- package/dist/esm/http-builder.js +186 -186
- package/dist/esm/http-builder.js.map +1 -1
- package/dist/esm/http-error.d.ts +10 -10
- package/dist/esm/http-error.js +25 -25
- package/dist/esm/http-error.js.map +1 -1
- package/dist/esm/http-response.d.ts +18 -18
- package/dist/esm/http-response.js +45 -45
- package/dist/esm/http-response.js.map +1 -1
- package/dist/esm/http.d.ts +33 -33
- package/dist/esm/http.js +91 -91
- package/dist/esm/http.js.map +1 -1
- package/dist/esm/http.spec.d.ts +1 -1
- package/dist/esm/http.spec.js +66 -66
- package/dist/esm/http.spec.js.map +1 -1
- package/dist/esm/index.d.ts +15 -15
- package/dist/esm/index.js +10 -10
- package/dist/esm/json/index.d.ts +15 -15
- package/dist/esm/json/index.js +71 -71
- package/dist/esm/jsonpatch/index.d.ts +9 -9
- package/dist/esm/jsonpatch/index.js +12 -12
- package/dist/esm/mapping.d.ts +9 -9
- package/dist/esm/mapping.js +31 -31
- package/dist/esm/mapping.js.map +1 -1
- package/dist/esm/msgpack/index.d.ts +8 -8
- package/dist/esm/msgpack/index.js +32 -32
- package/dist/esm/msgpack/index.js.map +1 -1
- package/dist/esm/pagination.d.ts +23 -23
- package/dist/esm/pagination.js +1 -1
- package/dist/esm/problem-details.d.ts +7 -7
- package/dist/esm/problem-details.js +1 -1
- package/dist/esm/query-string.d.ts +6 -6
- package/dist/esm/query-string.js +63 -61
- package/dist/esm/query-string.js.map +1 -1
- package/dist/esm/query-string.spec.d.ts +1 -1
- package/dist/esm/query-string.spec.js +49 -49
- package/dist/esm/status-codes.d.ts +67 -67
- package/dist/esm/status-codes.js +67 -67
- package/dist/esm/timeout-error.d.ts +3 -3
- package/dist/esm/timeout-error.js +9 -9
- package/package.json +15 -17
- package/plugins/json/node_modules/@utiliread/http/package.json +4 -0
- package/plugins/json/src/index.ts +124 -122
- package/plugins/jsonpatch/node_modules/@utiliread/http/package.json +4 -0
- package/plugins/jsonpatch/src/index.ts +31 -31
- package/plugins/msgpack/node_modules/@utiliread/http/package.json +4 -0
- package/plugins/msgpack/src/index.ts +67 -60
- package/src/event-aggregator.ts +21 -21
- package/src/events.ts +39 -39
- package/src/helpers.ts +6 -6
- package/src/http-builder.ts +252 -218
- package/src/http-error.ts +30 -23
- package/src/http-response.ts +1 -1
- package/src/http.spec.ts +1 -1
- package/src/http.ts +8 -5
- package/src/index.ts +1 -1
- package/src/mapping.ts +40 -32
- package/src/pagination.ts +16 -16
- package/src/problem-details.ts +6 -6
- package/src/query-string.spec.ts +59 -43
- package/src/query-string.ts +56 -58
- package/src/status-codes.ts +67 -67
- package/src/timeout-error.ts +7 -7
- package/tsconfig.cjs.json +1 -0
- package/tsconfig.json +1 -1
- package/web-test-runner.config.mjs +7 -0
- package/karma.config.js +0 -29
- package/src/mapping.d.ts +0 -9
- package/src/mapping.js +0 -32
- package/src/mapping.js.map +0 -1
package/dist/esm/http.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import type { Subscription } from "./event-aggregator";
|
|
2
|
-
import { HttpBuilder, HttpMethod, Message } from "./http-builder";
|
|
3
|
-
import { HttpResponse, HttpResponseOfT } from "./http-response";
|
|
4
|
-
export
|
|
5
|
-
export declare class Http {
|
|
6
|
-
static defaults: HttpOptions;
|
|
7
|
-
private static instance?;
|
|
8
|
-
options: HttpOptions;
|
|
9
|
-
constructor(options?: Partial<HttpOptions>);
|
|
10
|
-
static request(method: HttpMethod, url: string, params?: any): HttpBuilder;
|
|
11
|
-
static head(url: string, params?: any): HttpBuilder;
|
|
12
|
-
static post(url: string, params?: any): HttpBuilder;
|
|
13
|
-
static get(url: string, params?: any): HttpBuilder;
|
|
14
|
-
static put(url: string, params?: any): HttpBuilder;
|
|
15
|
-
static patch(url: string, params?: any): HttpBuilder;
|
|
16
|
-
static delete(url: string, params?: any): HttpBuilder;
|
|
17
|
-
private static getInstance;
|
|
18
|
-
request(method: HttpMethod, url: string, params?: any): HttpBuilder;
|
|
19
|
-
head(url: string, params?: any): HttpBuilder;
|
|
20
|
-
post(url: string, params?: any): HttpBuilder;
|
|
21
|
-
get(url: string, params?: any): HttpBuilder;
|
|
22
|
-
put(url: string, params?: any): HttpBuilder;
|
|
23
|
-
patch(url: string, params?: any): HttpBuilder;
|
|
24
|
-
delete(url: string, params?: any): HttpBuilder;
|
|
25
|
-
onSend(callback: (request: Message) => void | Promise<void>): Subscription;
|
|
26
|
-
onSent(callback: (response: HttpResponse, request: Message) => void | Promise<void>): Subscription;
|
|
27
|
-
onReceived(callback: (response: HttpResponseOfT<any>, request: Message, value: any) => void | Promise<void>): Subscription;
|
|
28
|
-
}
|
|
29
|
-
export interface HttpOptions {
|
|
30
|
-
fetch?: Fetch;
|
|
31
|
-
timeout?: number;
|
|
32
|
-
baseUrl?: string;
|
|
33
|
-
}
|
|
1
|
+
import type { Subscription } from "./event-aggregator";
|
|
2
|
+
import { HttpBuilder, HttpMethod, Message } from "./http-builder";
|
|
3
|
+
import { HttpResponse, HttpResponseOfT } from "./http-response";
|
|
4
|
+
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
5
|
+
export declare class Http {
|
|
6
|
+
static defaults: HttpOptions;
|
|
7
|
+
private static instance?;
|
|
8
|
+
options: HttpOptions;
|
|
9
|
+
constructor(options?: Partial<HttpOptions>);
|
|
10
|
+
static request(method: HttpMethod, url: string, params?: any): HttpBuilder;
|
|
11
|
+
static head(url: string, params?: any): HttpBuilder;
|
|
12
|
+
static post(url: string, params?: any): HttpBuilder;
|
|
13
|
+
static get(url: string, params?: any): HttpBuilder;
|
|
14
|
+
static put(url: string, params?: any): HttpBuilder;
|
|
15
|
+
static patch(url: string, params?: any): HttpBuilder;
|
|
16
|
+
static delete(url: string, params?: any): HttpBuilder;
|
|
17
|
+
private static getInstance;
|
|
18
|
+
request(method: HttpMethod, url: string, params?: any): HttpBuilder;
|
|
19
|
+
head(url: string, params?: any): HttpBuilder;
|
|
20
|
+
post(url: string, params?: any): HttpBuilder;
|
|
21
|
+
get(url: string, params?: any): HttpBuilder;
|
|
22
|
+
put(url: string, params?: any): HttpBuilder;
|
|
23
|
+
patch(url: string, params?: any): HttpBuilder;
|
|
24
|
+
delete(url: string, params?: any): HttpBuilder;
|
|
25
|
+
onSend(callback: (request: Message) => void | Promise<void>): Subscription;
|
|
26
|
+
onSent(callback: (response: HttpResponse, request: Message) => void | Promise<void>): Subscription;
|
|
27
|
+
onReceived(callback: (response: HttpResponseOfT<any>, request: Message, value: any) => void | Promise<void>): Subscription;
|
|
28
|
+
}
|
|
29
|
+
export interface HttpOptions {
|
|
30
|
+
fetch?: Fetch;
|
|
31
|
+
timeout?: number;
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
}
|
package/dist/esm/http.js
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { EventAggregator } from "./event-aggregator";
|
|
2
|
-
import { HttpBuilder } from "./http-builder";
|
|
3
|
-
import { QueryString } from "./query-string";
|
|
4
|
-
export class Http {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
/** @internal */
|
|
7
|
-
this._onSend = new EventAggregator();
|
|
8
|
-
/** @internal */
|
|
9
|
-
this._onSent = new EventAggregator();
|
|
10
|
-
/** @internal */
|
|
11
|
-
this._onReceived = new EventAggregator();
|
|
12
|
-
this.options = Object.assign({}, Http.defaults, options); // Later sources' properties overwrite earlier ones.
|
|
13
|
-
}
|
|
14
|
-
static request(method, url, params) {
|
|
15
|
-
return this.getInstance().request(method, url, params);
|
|
16
|
-
}
|
|
17
|
-
static head(url, params) {
|
|
18
|
-
return this.getInstance().head(url, params);
|
|
19
|
-
}
|
|
20
|
-
static post(url, params) {
|
|
21
|
-
return this.getInstance().post(url, params);
|
|
22
|
-
}
|
|
23
|
-
static get(url, params) {
|
|
24
|
-
return this.getInstance().get(url, params);
|
|
25
|
-
}
|
|
26
|
-
static put(url, params) {
|
|
27
|
-
return this.getInstance().put(url, params);
|
|
28
|
-
}
|
|
29
|
-
static patch(url, params) {
|
|
30
|
-
return this.getInstance().patch(url, params);
|
|
31
|
-
}
|
|
32
|
-
static delete(url, params) {
|
|
33
|
-
return this.getInstance().delete(url, params);
|
|
34
|
-
}
|
|
35
|
-
static getInstance() {
|
|
36
|
-
if (!this.instance) {
|
|
37
|
-
this.instance = new Http();
|
|
38
|
-
// The singleton instance should always use the static options
|
|
39
|
-
this.instance.options = Http.defaults;
|
|
40
|
-
}
|
|
41
|
-
return this.instance;
|
|
42
|
-
}
|
|
43
|
-
request(method, url, params) {
|
|
44
|
-
const message = {
|
|
45
|
-
method,
|
|
46
|
-
url: url + QueryString.serialize(params),
|
|
47
|
-
headers: new Headers(),
|
|
48
|
-
properties: {},
|
|
49
|
-
};
|
|
50
|
-
const fetch = this.options.fetch;
|
|
51
|
-
if (!fetch) {
|
|
52
|
-
throw Error("fetch() is not properly configured");
|
|
53
|
-
}
|
|
54
|
-
const builder = new HttpBuilder(message, {
|
|
55
|
-
fetch,
|
|
56
|
-
timeout: this.options.timeout,
|
|
57
|
-
baseUrl: this.options.baseUrl,
|
|
58
|
-
}, this);
|
|
59
|
-
return builder;
|
|
60
|
-
}
|
|
61
|
-
head(url, params) {
|
|
62
|
-
return this.request("HEAD", url, params);
|
|
63
|
-
}
|
|
64
|
-
post(url, params) {
|
|
65
|
-
return this.request("POST", url, params);
|
|
66
|
-
}
|
|
67
|
-
get(url, params) {
|
|
68
|
-
return this.request("GET", url, params);
|
|
69
|
-
}
|
|
70
|
-
put(url, params) {
|
|
71
|
-
return this.request("PUT", url, params);
|
|
72
|
-
}
|
|
73
|
-
patch(url, params) {
|
|
74
|
-
return this.request("PATCH", url, params);
|
|
75
|
-
}
|
|
76
|
-
delete(url, params) {
|
|
77
|
-
return this.request("DELETE", url, params);
|
|
78
|
-
}
|
|
79
|
-
onSend(callback) {
|
|
80
|
-
return this._onSend.subscribe(callback);
|
|
81
|
-
}
|
|
82
|
-
onSent(callback) {
|
|
83
|
-
return this._onSent.subscribe(callback);
|
|
84
|
-
}
|
|
85
|
-
onReceived(callback) {
|
|
86
|
-
return this._onReceived.subscribe(callback);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
Http.defaults = {
|
|
90
|
-
fetch: self.fetch ? self.fetch.bind(self) : undefined,
|
|
91
|
-
};
|
|
1
|
+
import { EventAggregator } from "./event-aggregator";
|
|
2
|
+
import { HttpBuilder } from "./http-builder";
|
|
3
|
+
import { QueryString } from "./query-string";
|
|
4
|
+
export class Http {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
/** @internal */
|
|
7
|
+
this._onSend = new EventAggregator();
|
|
8
|
+
/** @internal */
|
|
9
|
+
this._onSent = new EventAggregator();
|
|
10
|
+
/** @internal */
|
|
11
|
+
this._onReceived = new EventAggregator();
|
|
12
|
+
this.options = Object.assign({}, Http.defaults, options); // Later sources' properties overwrite earlier ones.
|
|
13
|
+
}
|
|
14
|
+
static request(method, url, params) {
|
|
15
|
+
return this.getInstance().request(method, url, params);
|
|
16
|
+
}
|
|
17
|
+
static head(url, params) {
|
|
18
|
+
return this.getInstance().head(url, params);
|
|
19
|
+
}
|
|
20
|
+
static post(url, params) {
|
|
21
|
+
return this.getInstance().post(url, params);
|
|
22
|
+
}
|
|
23
|
+
static get(url, params) {
|
|
24
|
+
return this.getInstance().get(url, params);
|
|
25
|
+
}
|
|
26
|
+
static put(url, params) {
|
|
27
|
+
return this.getInstance().put(url, params);
|
|
28
|
+
}
|
|
29
|
+
static patch(url, params) {
|
|
30
|
+
return this.getInstance().patch(url, params);
|
|
31
|
+
}
|
|
32
|
+
static delete(url, params) {
|
|
33
|
+
return this.getInstance().delete(url, params);
|
|
34
|
+
}
|
|
35
|
+
static getInstance() {
|
|
36
|
+
if (!this.instance) {
|
|
37
|
+
this.instance = new Http();
|
|
38
|
+
// The singleton instance should always use the static options
|
|
39
|
+
this.instance.options = Http.defaults;
|
|
40
|
+
}
|
|
41
|
+
return this.instance;
|
|
42
|
+
}
|
|
43
|
+
request(method, url, params) {
|
|
44
|
+
const message = {
|
|
45
|
+
method,
|
|
46
|
+
url: url + QueryString.serialize(params),
|
|
47
|
+
headers: new Headers(),
|
|
48
|
+
properties: {},
|
|
49
|
+
};
|
|
50
|
+
const fetch = this.options.fetch;
|
|
51
|
+
if (!fetch) {
|
|
52
|
+
throw Error("fetch() is not properly configured");
|
|
53
|
+
}
|
|
54
|
+
const builder = new HttpBuilder(message, {
|
|
55
|
+
fetch,
|
|
56
|
+
timeout: this.options.timeout,
|
|
57
|
+
baseUrl: this.options.baseUrl,
|
|
58
|
+
}, this);
|
|
59
|
+
return builder;
|
|
60
|
+
}
|
|
61
|
+
head(url, params) {
|
|
62
|
+
return this.request("HEAD", url, params);
|
|
63
|
+
}
|
|
64
|
+
post(url, params) {
|
|
65
|
+
return this.request("POST", url, params);
|
|
66
|
+
}
|
|
67
|
+
get(url, params) {
|
|
68
|
+
return this.request("GET", url, params);
|
|
69
|
+
}
|
|
70
|
+
put(url, params) {
|
|
71
|
+
return this.request("PUT", url, params);
|
|
72
|
+
}
|
|
73
|
+
patch(url, params) {
|
|
74
|
+
return this.request("PATCH", url, params);
|
|
75
|
+
}
|
|
76
|
+
delete(url, params) {
|
|
77
|
+
return this.request("DELETE", url, params);
|
|
78
|
+
}
|
|
79
|
+
onSend(callback) {
|
|
80
|
+
return this._onSend.subscribe(callback);
|
|
81
|
+
}
|
|
82
|
+
onSent(callback) {
|
|
83
|
+
return this._onSent.subscribe(callback);
|
|
84
|
+
}
|
|
85
|
+
onReceived(callback) {
|
|
86
|
+
return this._onReceived.subscribe(callback);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
Http.defaults = {
|
|
90
|
+
fetch: self.fetch ? self.fetch.bind(self) : undefined,
|
|
91
|
+
};
|
|
92
92
|
//# sourceMappingURL=http.js.map
|
package/dist/esm/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,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AC1C,CAAC;IAED,UAAU,CACR,QAIyB;QAEzB,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;;AAtHM,aAAQ,GAAgB;IAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;CACtD,AAFc,CAEb"}
|
package/dist/esm/http.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/esm/http.spec.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
describe("static http", () => {
|
|
4
|
-
it("can get", () => {
|
|
5
|
-
const builder = Http.get("hello");
|
|
6
|
-
expect(builder.getUrl()).to.equal("hello");
|
|
7
|
-
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
8
|
-
});
|
|
9
|
-
it("can get with leading /", () => {
|
|
10
|
-
const builder = Http.get("/hello");
|
|
11
|
-
expect(builder.getUrl()).to.equal("/hello");
|
|
12
|
-
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
13
|
-
});
|
|
14
|
-
it("can get with changed default fetch", () => {
|
|
15
|
-
Http.get("/hello"); // Creates internal singleton
|
|
16
|
-
// Change static default after request is created
|
|
17
|
-
const fetch = Http.defaults.fetch;
|
|
18
|
-
Http.defaults.fetch = fakeFetch;
|
|
19
|
-
const builder = Http.get("/hello");
|
|
20
|
-
expect(builder.options.fetch).to.equal(fakeFetch);
|
|
21
|
-
Http.defaults.fetch = fetch;
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
describe("instance http", () => {
|
|
25
|
-
it("can get with different timeout", () => {
|
|
26
|
-
const http = new Http();
|
|
27
|
-
const builder = http.get("/hello");
|
|
28
|
-
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
29
|
-
expect(builder.options.timeout).to.equal(undefined);
|
|
30
|
-
});
|
|
31
|
-
it("can get with different timeout", () => {
|
|
32
|
-
const http = new Http({ timeout: 123 });
|
|
33
|
-
const builder = http.get("/hello");
|
|
34
|
-
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
35
|
-
expect(builder.options.timeout).to.equal(123);
|
|
36
|
-
});
|
|
37
|
-
it("can get with different fetch", () => {
|
|
38
|
-
const http = new Http({ fetch: fakeFetch });
|
|
39
|
-
const builder = http.get("/hello");
|
|
40
|
-
expect(builder.options.fetch).to.equal(fakeFetch);
|
|
41
|
-
expect(builder.options.timeout).to.equal(undefined);
|
|
42
|
-
});
|
|
43
|
-
it("can get hello with base url", () => {
|
|
44
|
-
const http = new Http({ baseUrl: "base" });
|
|
45
|
-
const builder = http.get("hello");
|
|
46
|
-
expect(builder.getUrl()).to.equal("base/hello");
|
|
47
|
-
});
|
|
48
|
-
it("can get hello with base/", () => {
|
|
49
|
-
const http = new Http({ baseUrl: "base/" });
|
|
50
|
-
const builder = http.get("hello");
|
|
51
|
-
expect(builder.getUrl()).to.equal("base/hello");
|
|
52
|
-
});
|
|
53
|
-
it("can get /hello with base url", () => {
|
|
54
|
-
const http = new Http({ baseUrl: "base" });
|
|
55
|
-
const builder = http.get("/hello");
|
|
56
|
-
expect(builder.getUrl()).to.equal("base/hello");
|
|
57
|
-
});
|
|
58
|
-
it("can get /hello with base/", () => {
|
|
59
|
-
const http = new Http({ baseUrl: "base/" });
|
|
60
|
-
const builder = http.get("/hello");
|
|
61
|
-
expect(builder.getUrl()).to.equal("base/hello");
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
function fakeFetch(input, init) {
|
|
65
|
-
return Promise.resolve(new Response());
|
|
66
|
-
}
|
|
1
|
+
import { Http } from "./http";
|
|
2
|
+
import { expect } from "chai";
|
|
3
|
+
describe("static http", () => {
|
|
4
|
+
it("can get", () => {
|
|
5
|
+
const builder = Http.get("hello");
|
|
6
|
+
expect(builder.getUrl()).to.equal("hello");
|
|
7
|
+
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
8
|
+
});
|
|
9
|
+
it("can get with leading /", () => {
|
|
10
|
+
const builder = Http.get("/hello");
|
|
11
|
+
expect(builder.getUrl()).to.equal("/hello");
|
|
12
|
+
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
13
|
+
});
|
|
14
|
+
it("can get with changed default fetch", () => {
|
|
15
|
+
Http.get("/hello"); // Creates internal singleton
|
|
16
|
+
// Change static default after request is created
|
|
17
|
+
const fetch = Http.defaults.fetch;
|
|
18
|
+
Http.defaults.fetch = fakeFetch;
|
|
19
|
+
const builder = Http.get("/hello");
|
|
20
|
+
expect(builder.options.fetch).to.equal(fakeFetch);
|
|
21
|
+
Http.defaults.fetch = fetch;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("instance http", () => {
|
|
25
|
+
it("can get with different timeout", () => {
|
|
26
|
+
const http = new Http();
|
|
27
|
+
const builder = http.get("/hello");
|
|
28
|
+
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
29
|
+
expect(builder.options.timeout).to.equal(undefined);
|
|
30
|
+
});
|
|
31
|
+
it("can get with different timeout", () => {
|
|
32
|
+
const http = new Http({ timeout: 123 });
|
|
33
|
+
const builder = http.get("/hello");
|
|
34
|
+
expect(builder.options.fetch).to.equal(Http.defaults.fetch);
|
|
35
|
+
expect(builder.options.timeout).to.equal(123);
|
|
36
|
+
});
|
|
37
|
+
it("can get with different fetch", () => {
|
|
38
|
+
const http = new Http({ fetch: fakeFetch });
|
|
39
|
+
const builder = http.get("/hello");
|
|
40
|
+
expect(builder.options.fetch).to.equal(fakeFetch);
|
|
41
|
+
expect(builder.options.timeout).to.equal(undefined);
|
|
42
|
+
});
|
|
43
|
+
it("can get hello with base url", () => {
|
|
44
|
+
const http = new Http({ baseUrl: "base" });
|
|
45
|
+
const builder = http.get("hello");
|
|
46
|
+
expect(builder.getUrl()).to.equal("base/hello");
|
|
47
|
+
});
|
|
48
|
+
it("can get hello with base/", () => {
|
|
49
|
+
const http = new Http({ baseUrl: "base/" });
|
|
50
|
+
const builder = http.get("hello");
|
|
51
|
+
expect(builder.getUrl()).to.equal("base/hello");
|
|
52
|
+
});
|
|
53
|
+
it("can get /hello with base url", () => {
|
|
54
|
+
const http = new Http({ baseUrl: "base" });
|
|
55
|
+
const builder = http.get("/hello");
|
|
56
|
+
expect(builder.getUrl()).to.equal("base/hello");
|
|
57
|
+
});
|
|
58
|
+
it("can get /hello with base/", () => {
|
|
59
|
+
const http = new Http({ baseUrl: "base/" });
|
|
60
|
+
const builder = http.get("/hello");
|
|
61
|
+
expect(builder.getUrl()).to.equal("base/hello");
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
function fakeFetch(input, init) {
|
|
65
|
+
return Promise.resolve(new Response());
|
|
66
|
+
}
|
|
67
67
|
//# sourceMappingURL=http.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.spec.js","sourceRoot":"","sources":["../../src/http.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"http.spec.js","sourceRoot":"","sources":["../../src/http.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,C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ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { Http } from "./http";
|
|
2
|
-
export type { Page, PaginationResult, InfinitePage, InfinitePaginationResult, } from "./pagination";
|
|
3
|
-
export type { ProblemDetails } from "./problem-details";
|
|
4
|
-
export { QueryString } from "./query-string";
|
|
5
|
-
export { HttpResponse, HttpResponseOfT } from "./http-response";
|
|
6
|
-
export { HttpBuilder, HttpBuilderOfT } from "./http-builder";
|
|
7
|
-
export type { Message } from "./http-builder";
|
|
8
|
-
export { HttpError } from "./http-error";
|
|
9
|
-
export { TimeoutError } from "./timeout-error";
|
|
10
|
-
export { events } from "./events";
|
|
11
|
-
export * from "./helpers";
|
|
12
|
-
export type { Fetch } from "./http";
|
|
13
|
-
export type { Subscription } from "./event-aggregator";
|
|
14
|
-
export { statusCodes } from "./status-codes";
|
|
15
|
-
export * as Mapping from "./mapping";
|
|
1
|
+
export { Http } from "./http";
|
|
2
|
+
export type { Page, PaginationResult, InfinitePage, InfinitePaginationResult, } from "./pagination";
|
|
3
|
+
export type { ProblemDetails } from "./problem-details";
|
|
4
|
+
export { QueryString } from "./query-string";
|
|
5
|
+
export { HttpResponse, HttpResponseOfT } from "./http-response";
|
|
6
|
+
export { HttpBuilder, HttpBuilderOfT } from "./http-builder";
|
|
7
|
+
export type { Message } from "./http-builder";
|
|
8
|
+
export { HttpError } from "./http-error";
|
|
9
|
+
export { TimeoutError } from "./timeout-error";
|
|
10
|
+
export { events } from "./events";
|
|
11
|
+
export * from "./helpers";
|
|
12
|
+
export type { Fetch } from "./http";
|
|
13
|
+
export type { Subscription } from "./event-aggregator";
|
|
14
|
+
export { statusCodes } from "./status-codes";
|
|
15
|
+
export * as Mapping from "./mapping";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Http } from "./http";
|
|
2
|
-
export { QueryString } from "./query-string";
|
|
3
|
-
export { HttpResponse, HttpResponseOfT } from "./http-response";
|
|
4
|
-
export { HttpBuilder, HttpBuilderOfT } from "./http-builder";
|
|
5
|
-
export { HttpError } from "./http-error";
|
|
6
|
-
export { TimeoutError } from "./timeout-error";
|
|
7
|
-
export { events } from "./events";
|
|
8
|
-
export * from "./helpers";
|
|
9
|
-
export { statusCodes } from "./status-codes";
|
|
10
|
-
export * as Mapping from "./mapping";
|
|
1
|
+
export { Http } from "./http";
|
|
2
|
+
export { QueryString } from "./query-string";
|
|
3
|
+
export { HttpResponse, HttpResponseOfT } from "./http-response";
|
|
4
|
+
export { HttpBuilder, HttpBuilderOfT } from "./http-builder";
|
|
5
|
+
export { HttpError } from "./http-error";
|
|
6
|
+
export { TimeoutError } from "./timeout-error";
|
|
7
|
+
export { events } from "./events";
|
|
8
|
+
export * from "./helpers";
|
|
9
|
+
export { statusCodes } from "./status-codes";
|
|
10
|
+
export * as Mapping from "./mapping";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/json/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Mapping } from "@utiliread/http";
|
|
2
|
-
import type { InfinitePaginationResult, PaginationResult } from "@utiliread/http";
|
|
3
|
-
declare module "@utiliread/http" {
|
|
4
|
-
interface HttpBuilder {
|
|
5
|
-
withJson(content: any): this;
|
|
6
|
-
expectJson<T>(typeOrMapper?: Mapping.TypeOrMapper<T>): HttpBuilderOfT<T>;
|
|
7
|
-
expectJsonArray<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<T[]>;
|
|
8
|
-
expectJsonNullableArray<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<(T | null)[]>;
|
|
9
|
-
expectJsonPaginationResult<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<PaginationResult<T>>;
|
|
10
|
-
expectJsonInfinitePaginationResult<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<InfinitePaginationResult<T>>;
|
|
11
|
-
}
|
|
12
|
-
interface HttpBuilderOfT<T> {
|
|
13
|
-
withJson(content: any): this;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { Mapping } from "@utiliread/http";
|
|
2
|
+
import type { InfinitePaginationResult, PaginationResult } from "@utiliread/http";
|
|
3
|
+
declare module "@utiliread/http" {
|
|
4
|
+
interface HttpBuilder {
|
|
5
|
+
withJson(content: any): this;
|
|
6
|
+
expectJson<T>(typeOrMapper?: Mapping.TypeOrMapper<T>): HttpBuilderOfT<T>;
|
|
7
|
+
expectJsonArray<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<T[]>;
|
|
8
|
+
expectJsonNullableArray<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<(T | null)[]>;
|
|
9
|
+
expectJsonPaginationResult<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<PaginationResult<T>>;
|
|
10
|
+
expectJsonInfinitePaginationResult<T>(typeOrMapper: Mapping.TypeOrMapper<T>): HttpBuilderOfT<InfinitePaginationResult<T>>;
|
|
11
|
+
}
|
|
12
|
+
interface HttpBuilderOfT<T> {
|
|
13
|
+
withJson(content: any): this;
|
|
14
|
+
}
|
|
15
|
+
}
|