kaafil-js 0.6.0 → 0.6.2
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/client-entry.cjs +14 -1
- package/dist/client-entry.cjs.map +1 -1
- package/dist/client-entry.js +14 -1
- package/dist/client-entry.js.map +1 -1
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/client-entry.js
CHANGED
|
@@ -1759,7 +1759,8 @@ function parseRetryAfterSeconds(headerValue) {
|
|
|
1759
1759
|
return Number.isFinite(seconds) && seconds >= 0 ? seconds : void 0;
|
|
1760
1760
|
}
|
|
1761
1761
|
function attachMeta(data, meta, facets) {
|
|
1762
|
-
const
|
|
1762
|
+
const base = data === void 0 || data === null ? {} : data;
|
|
1763
|
+
const withMeta = Object.assign(base, { meta });
|
|
1763
1764
|
return facets === void 0 ? withMeta : Object.assign(withMeta, { facets });
|
|
1764
1765
|
}
|
|
1765
1766
|
function describeCrossOriginSuspect(url) {
|
|
@@ -1823,6 +1824,18 @@ function sendOnce(ctx, request, idempotencyKey) {
|
|
|
1823
1824
|
return sendOnceWith(ctx, request, idempotencyKey, async (response, status, requestId) => {
|
|
1824
1825
|
const text = await response.text();
|
|
1825
1826
|
const body = text.length > 0 ? tryParseJson(text) : void 0;
|
|
1827
|
+
if (body === void 0 && status >= 200 && status < 300) {
|
|
1828
|
+
const serverDate = response.headers.get("date");
|
|
1829
|
+
return {
|
|
1830
|
+
data: void 0,
|
|
1831
|
+
meta: {
|
|
1832
|
+
status,
|
|
1833
|
+
requestId,
|
|
1834
|
+
...serverDate === null ? {} : { serverTime: new Date(serverDate).toISOString() }
|
|
1835
|
+
},
|
|
1836
|
+
facets: void 0
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1826
1839
|
if (!isSuccessEnvelope(body)) {
|
|
1827
1840
|
throw new KaafilNetworkError(`Received an unrecognizable success body for HTTP ${status}`, {
|
|
1828
1841
|
status,
|