kubernetes-fluent-client 1.3.0 → 1.3.1
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/fetch.d.ts.map +1 -1
- package/dist/fetch.js +7 -9
- package/package.json +1 -1
- package/src/fetch.ts +6 -8
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":";AAIA,OAAiB,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,GAAG,EAAE,GAAG,GAAG,WAAW,EACtB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":";AAIA,OAAiB,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,GAAG,EAAE,GAAG,GAAG,WAAW,EACtB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAwC3B"}
|
package/dist/fetch.js
CHANGED
|
@@ -46,15 +46,13 @@ async function fetch(url, init) {
|
|
|
46
46
|
try {
|
|
47
47
|
const resp = await (0, node_fetch_1.default)(url, init);
|
|
48
48
|
const contentType = resp.headers.get("content-type") || "";
|
|
49
|
-
if
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
data = (await resp.text());
|
|
57
|
-
}
|
|
49
|
+
// Parse the response as JSON if the content type is JSON
|
|
50
|
+
if (contentType.includes("application/json")) {
|
|
51
|
+
data = await resp.json();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Otherwise, return however the response was read
|
|
55
|
+
data = (await resp.text());
|
|
58
56
|
}
|
|
59
57
|
return {
|
|
60
58
|
data,
|
package/package.json
CHANGED
package/src/fetch.ts
CHANGED
|
@@ -33,14 +33,12 @@ export async function fetch<T>(
|
|
|
33
33
|
const resp = await fetchRaw(url, init);
|
|
34
34
|
const contentType = resp.headers.get("content-type") || "";
|
|
35
35
|
|
|
36
|
-
if
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
data = (await resp.text()) as unknown as T;
|
|
43
|
-
}
|
|
36
|
+
// Parse the response as JSON if the content type is JSON
|
|
37
|
+
if (contentType.includes("application/json")) {
|
|
38
|
+
data = await resp.json();
|
|
39
|
+
} else {
|
|
40
|
+
// Otherwise, return however the response was read
|
|
41
|
+
data = (await resp.text()) as unknown as T;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
return {
|