@furystack/rest-client-fetch 4.0.9 → 4.0.12
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/dist/create-client.js +3 -4
- package/dist/create-client.js.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/dist/create-client.js
CHANGED
|
@@ -8,7 +8,6 @@ const path_to_regexp_1 = require("path-to-regexp");
|
|
|
8
8
|
const createClient = (clientOptions) => {
|
|
9
9
|
const fetchMethod = clientOptions.fetch || fetch;
|
|
10
10
|
return async (options) => {
|
|
11
|
-
var _a, _b, _c;
|
|
12
11
|
const { url, query, body, headers } = options;
|
|
13
12
|
const urlToSend = (url ? (0, path_to_regexp_1.compile)(options.action)(url) : options.action) +
|
|
14
13
|
(query
|
|
@@ -23,7 +22,7 @@ const createClient = (clientOptions) => {
|
|
|
23
22
|
...(headers
|
|
24
23
|
? {
|
|
25
24
|
headers: {
|
|
26
|
-
...
|
|
25
|
+
...clientOptions.requestInit?.headers,
|
|
27
26
|
...headers,
|
|
28
27
|
},
|
|
29
28
|
}
|
|
@@ -32,8 +31,8 @@ const createClient = (clientOptions) => {
|
|
|
32
31
|
if (!response.ok) {
|
|
33
32
|
throw new response_error_1.ResponseError(response.statusText, response);
|
|
34
33
|
}
|
|
35
|
-
const contentType =
|
|
36
|
-
if (contentType
|
|
34
|
+
const contentType = response.headers?.get?.('Content-Type');
|
|
35
|
+
if (contentType?.startsWith('text/')) {
|
|
37
36
|
const result = (await response.text());
|
|
38
37
|
return { response, result };
|
|
39
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-client.js","sourceRoot":"","sources":["../src/create-client.ts"],"names":[],"mappings":";;;AAAA,0CAAiE;AACjE,4CAA6C;AAC7C,qDAAgD;AAChD,mDAAwC;AAoBjC,MAAM,YAAY,GAAG,CAAoB,aAA4B,EAAE,EAAE;IAC9E,MAAM,WAAW,GAAG,aAA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wBACrC,GAAG,OAAO;qBACX;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YAChB,MAAM,IAAI,8BAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;SACvD;QAED,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAA;QAE3D,IAAI,WAAW,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;YACpC,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAa,CAAA;YAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;SAC5B;QAED,IAAI,WAAW,KAAK,gBAAgB,EAAE;YACpC,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAa,CAAA;YACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;SAC5B;QAED,IAAI;YACF,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAa,CAAA;YAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;SAC5B;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAgB,EAAE,CAAA;SAC9C;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAlEY,QAAA,YAAY,gBAkExB"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./response-error"), exports);
|
|
17
|
+
__exportStar(require("./create-client"), exports);
|
|
18
|
+
__exportStar(require("./response-error"), exports);
|
|
6
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,mDAAgC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/rest-client-fetch",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.12",
|
|
4
4
|
"description": "Native browser fetch based REST API implementation for FuryStack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -29,15 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/furystack/furystack",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@furystack/inject": "^7.0.
|
|
33
|
-
"@furystack/logging": "^3.0.
|
|
34
|
-
"@furystack/rest": "^4.0.
|
|
35
|
-
"@furystack/utils": "^3.0.
|
|
36
|
-
"path-to-regexp": "^6.2.1"
|
|
37
|
-
"tslib": "^2.4.0"
|
|
32
|
+
"@furystack/inject": "^7.0.4",
|
|
33
|
+
"@furystack/logging": "^3.0.8",
|
|
34
|
+
"@furystack/rest": "^4.0.10",
|
|
35
|
+
"@furystack/utils": "^3.0.8",
|
|
36
|
+
"path-to-regexp": "^6.2.1"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@types/jest": "^
|
|
39
|
+
"@types/jest": "^29.0.0"
|
|
41
40
|
},
|
|
42
41
|
"typings": "./types/index.d.ts",
|
|
43
42
|
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321"
|