etherreq 1.1.13 → 1.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etherreq",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "A lightweight custom HTTP request library.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/types/etherreq.d.ts",
package/src/etherreq.js CHANGED
@@ -18,9 +18,7 @@ const dispatchRequest = async (config) => {
18
18
  const nextConfig = await interceptor.fulfilled(config);
19
19
  // ✅ 拦截器可以返回一个 response 对象,表示中断请求
20
20
  if (nextConfig && nextConfig.isFromCache) {
21
- console.log(nextConfig);
22
-
23
- return nextConfig; // ✅ 直接返回缓存结果,不再往下执行
21
+ return nextConfig.data; // ✅ 直接返回缓存结果,不再往下执行
24
22
  }
25
23
  config = nextConfig;
26
24
  }
package/src/request.js CHANGED
@@ -22,7 +22,6 @@ instance.interceptors.request.use((config) => {
22
22
  const cached = requestCache.get(cacheKey);
23
23
 
24
24
  if (cached) {
25
- console.log('命中缓存:', cacheKey);
26
25
  return Promise.resolve({
27
26
  data: cached,
28
27
  status: 200,
@@ -43,7 +42,6 @@ instance.interceptors.request.use((config) => {
43
42
  instance.interceptors.response.use(
44
43
  (response) => {
45
44
  if (response.isFromCache) {
46
- console.log('从缓存返回');
47
45
  return response.data;
48
46
  }
49
47
 
@@ -51,7 +49,6 @@ instance.interceptors.response.use(
51
49
  if (config && config.method === 'GET' && !config.disableCache) {
52
50
  const cacheKey = getCacheKey(config.url, config);
53
51
  requestCache.set(cacheKey, response.data);
54
- console.log('写入缓存:', cacheKey);
55
52
  }
56
53
 
57
54
  return response.data;