kaafil-js 0.6.0 → 0.6.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/index.cjs CHANGED
@@ -1877,6 +1877,18 @@ function sendOnce(ctx, request, idempotencyKey) {
1877
1877
  return sendOnceWith(ctx, request, idempotencyKey, async (response, status, requestId) => {
1878
1878
  const text = await response.text();
1879
1879
  const body = text.length > 0 ? tryParseJson(text) : void 0;
1880
+ if (body === void 0 && status >= 200 && status < 300) {
1881
+ const serverDate = response.headers.get("date");
1882
+ return {
1883
+ data: void 0,
1884
+ meta: {
1885
+ status,
1886
+ requestId,
1887
+ ...serverDate === null ? {} : { serverTime: new Date(serverDate).toISOString() }
1888
+ },
1889
+ facets: void 0
1890
+ };
1891
+ }
1880
1892
  if (!isSuccessEnvelope(body)) {
1881
1893
  throw new KaafilNetworkError(`Received an unrecognizable success body for HTTP ${status}`, {
1882
1894
  status,