xxf_react 0.8.6 → 0.8.7

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.
@@ -7,6 +7,7 @@ import { CacheInterceptor } from './CacheInterceptor';
7
7
  * 默认缓存拦截器
8
8
  *
9
9
  * 只有满足以下条件才缓存:
10
+ * - 请求方法为 GET
10
11
  * - HTTP 状态码 = 200
11
12
  * - Content-Type 包含 application/json(不区分大小写)
12
13
  * - data 是有效对象或数组
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultCacheInterceptor.d.ts","sourceRoot":"","sources":["../../../src/http/interceptor/DefaultCacheInterceptor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAuCrC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,GAChE,gBAAgB,CAiBlB"}
1
+ {"version":3,"file":"DefaultCacheInterceptor.d.ts","sourceRoot":"","sources":["../../../src/http/interceptor/DefaultCacheInterceptor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBA4CrC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,GAChE,gBAAgB,CAiBlB"}
@@ -7,6 +7,7 @@ import { isApiSuccess } from '../../models';
7
7
  * 默认缓存拦截器
8
8
  *
9
9
  * 只有满足以下条件才缓存:
10
+ * - 请求方法为 GET
10
11
  * - HTTP 状态码 = 200
11
12
  * - Content-Type 包含 application/json(不区分大小写)
12
13
  * - data 是有效对象或数组
@@ -27,6 +28,10 @@ import { isApiSuccess } from '../../models';
27
28
  export const defaultCacheInterceptor = (ctx) => {
28
29
  var _a, _b;
29
30
  try {
31
+ // 0. 只缓存 GET 请求
32
+ if (ctx.request.method !== 'GET') {
33
+ return false;
34
+ }
30
35
  // 1. 检查 HTTP 状态码
31
36
  if (ctx.status !== 200) {
32
37
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xxf_react",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",