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