@nextgis/ngw-connector 3.0.0-alpha.13 → 3.0.0-alpha.14

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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-connector; version: 3.0.0-alpha.13; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-connector; version: 3.0.0-alpha.14; author: NextGIS */
2
2
  var NgwConnector = (function () {
3
3
  'use strict';
4
4
 
@@ -776,7 +776,7 @@ var NgwConnector = (function () {
776
776
 
777
777
  var pkg = {
778
778
  name: "@nextgis/ngw-connector",
779
- version: "3.0.0-alpha.13",
779
+ version: "3.0.0-alpha.14",
780
780
  _priority: 12,
781
781
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
782
782
  main: "index.js",
@@ -1172,7 +1172,7 @@ var NgwConnector = (function () {
1172
1172
  }
1173
1173
  function request(path, options, cacheEngine) {
1174
1174
  return __async$3(this, null, function* () {
1175
- var _b;
1175
+ var _b, _c;
1176
1176
  const defaults = {
1177
1177
  method: "GET",
1178
1178
  credentials: "same-origin",
@@ -1197,6 +1197,7 @@ var NgwConnector = (function () {
1197
1197
  "query",
1198
1198
  "json"
1199
1199
  ]);
1200
+ opt.method = (_b = opt.method) == null ? void 0 : _b.toUpperCase();
1200
1201
  if (withCredentials) {
1201
1202
  opt.credentials = "include";
1202
1203
  }
@@ -1254,15 +1255,21 @@ var NgwConnector = (function () {
1254
1255
  }
1255
1256
  return body;
1256
1257
  });
1257
- if (cacheEngine && cache !== false && ((_b = opt.method) == null ? void 0 : _b.toUpperCase()) === "GET") {
1258
- const props = cacheProps ? cacheProps : __spreadValues$3({}, objectRemoveEmpty({
1259
- withCredentials,
1260
- responseType
1261
- }));
1262
- return cacheEngine.add(cacheName || url, makeRequest, {
1263
- props,
1264
- expirationTime: cache ? void 0 : 500
1265
- });
1258
+ if (cacheEngine) {
1259
+ if (((_c = opt.method) == null ? void 0 : _c.toUpperCase()) === "GET") {
1260
+ if (cache !== false) {
1261
+ const props = cacheProps ? cacheProps : __spreadValues$3({}, objectRemoveEmpty({
1262
+ withCredentials,
1263
+ responseType
1264
+ }));
1265
+ return cacheEngine.add(cacheName || url, makeRequest, {
1266
+ props,
1267
+ expirationTime: cache ? void 0 : 500
1268
+ });
1269
+ }
1270
+ } else {
1271
+ cacheEngine.clean();
1272
+ }
1266
1273
  }
1267
1274
  return makeRequest();
1268
1275
  });