@hkdigital/lib-sveltekit 0.0.71 → 0.0.72
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.
@@ -7,7 +7,7 @@
|
|
7
7
|
/**
|
8
8
|
* Make GET request
|
9
9
|
*
|
10
|
-
* @
|
10
|
+
* @param {object} _
|
11
11
|
*
|
12
12
|
* @param {string|URL} _.url - Url string or URL object
|
13
13
|
*
|
@@ -25,13 +25,19 @@
|
|
25
25
|
* If defined, this request will abort after the specified number of
|
26
26
|
* milliseconds. Values above the the built-in request timeout won't work.
|
27
27
|
*
|
28
|
-
* @returns {Promise
|
28
|
+
* @returns {Promise<Response>} responsePromise
|
29
29
|
*/
|
30
|
-
export function httpGet({ url, urlSearchParams, headers, requestHandler, timeoutMs }:
|
30
|
+
export function httpGet({ url, urlSearchParams, headers, requestHandler, timeoutMs }: {
|
31
|
+
url: string | URL;
|
32
|
+
urlSearchParams?: object;
|
33
|
+
headers?: object;
|
34
|
+
requestHandler?: requestHandler;
|
35
|
+
timeoutMs?: number;
|
36
|
+
}): Promise<Response>;
|
31
37
|
/**
|
32
38
|
* Make POST request
|
33
39
|
*
|
34
|
-
* @
|
40
|
+
* @param {object} _
|
35
41
|
*
|
36
42
|
* @param {string|URL} _.url - Url string or URL object
|
37
43
|
*
|
@@ -48,15 +54,21 @@ export function httpGet({ url, urlSearchParams, headers, requestHandler, timeout
|
|
48
54
|
* If defined, this request will abort after the specified number of
|
49
55
|
* milliseconds. Values above the the built-in request timeout won't work.
|
50
56
|
*
|
51
|
-
* @returns {Promise
|
57
|
+
* @returns {Promise<Response>} responsePromise
|
52
58
|
*/
|
53
|
-
export function httpPost({ url, body, headers, requestHandler, timeoutMs }:
|
59
|
+
export function httpPost({ url, body, headers, requestHandler, timeoutMs }: {
|
60
|
+
url: string | URL;
|
61
|
+
body?: any;
|
62
|
+
headers?: object;
|
63
|
+
requestHandler?: requestHandler;
|
64
|
+
timeoutMs?: number;
|
65
|
+
}): Promise<Response>;
|
54
66
|
/**
|
55
67
|
* Make an HTTP request
|
56
68
|
* - This is a low level function, consider using
|
57
69
|
* httpGet, httpPost, jsonGet or jsonPost instead
|
58
70
|
*
|
59
|
-
* @
|
71
|
+
* @param {object} _
|
60
72
|
*
|
61
73
|
* @param {string|URL} _.url - Url string or URL object
|
62
74
|
*
|
@@ -84,5 +96,13 @@ export function httpPost({ url, body, headers, requestHandler, timeoutMs }: stri
|
|
84
96
|
*
|
85
97
|
* @returns {Promise<Response>} responsePromise
|
86
98
|
*/
|
87
|
-
export function httpRequest({ method, url, urlSearchParams, body, headers, requestHandler, timeoutMs }:
|
99
|
+
export function httpRequest({ method, url, urlSearchParams, body, headers, requestHandler, timeoutMs }: {
|
100
|
+
url: string | URL;
|
101
|
+
method: string;
|
102
|
+
urlSearchParams?: object;
|
103
|
+
body?: any;
|
104
|
+
headers?: object;
|
105
|
+
requestHandler?: requestHandler;
|
106
|
+
timeoutMs?: number;
|
107
|
+
}): Promise<Response>;
|
88
108
|
export type requestHandler = (controller: AbortController, abort: (reason?: Error) => void, timeout: (delayMs: number) => void) => any;
|
@@ -21,7 +21,7 @@ import { waitForAndCheckResponse } from './response.js';
|
|
21
21
|
/**
|
22
22
|
* Make GET request
|
23
23
|
*
|
24
|
-
* @
|
24
|
+
* @param {object} _
|
25
25
|
*
|
26
26
|
* @param {string|URL} _.url - Url string or URL object
|
27
27
|
*
|
@@ -39,7 +39,7 @@ import { waitForAndCheckResponse } from './response.js';
|
|
39
39
|
* If defined, this request will abort after the specified number of
|
40
40
|
* milliseconds. Values above the the built-in request timeout won't work.
|
41
41
|
*
|
42
|
-
* @returns {Promise
|
42
|
+
* @returns {Promise<Response>} responsePromise
|
43
43
|
*/
|
44
44
|
export async function httpGet({ url, urlSearchParams, headers, requestHandler, timeoutMs }) {
|
45
45
|
const responsePromise = httpRequest({
|
@@ -57,7 +57,7 @@ export async function httpGet({ url, urlSearchParams, headers, requestHandler, t
|
|
57
57
|
/**
|
58
58
|
* Make POST request
|
59
59
|
*
|
60
|
-
* @
|
60
|
+
* @param {object} _
|
61
61
|
*
|
62
62
|
* @param {string|URL} _.url - Url string or URL object
|
63
63
|
*
|
@@ -74,7 +74,7 @@ export async function httpGet({ url, urlSearchParams, headers, requestHandler, t
|
|
74
74
|
* If defined, this request will abort after the specified number of
|
75
75
|
* milliseconds. Values above the the built-in request timeout won't work.
|
76
76
|
*
|
77
|
-
* @returns {Promise
|
77
|
+
* @returns {Promise<Response>} responsePromise
|
78
78
|
*/
|
79
79
|
export async function httpPost({ url, body = null, headers, requestHandler, timeoutMs }) {
|
80
80
|
const responsePromise = httpRequest({
|
@@ -96,7 +96,7 @@ export async function httpPost({ url, body = null, headers, requestHandler, time
|
|
96
96
|
* - This is a low level function, consider using
|
97
97
|
* httpGet, httpPost, jsonGet or jsonPost instead
|
98
98
|
*
|
99
|
-
* @
|
99
|
+
* @param {object} _
|
100
100
|
*
|
101
101
|
* @param {string|URL} _.url - Url string or URL object
|
102
102
|
*
|