소스 검색

fix:当method未传值时,默认为GET

louhangfei 1 년 전
부모
커밋
c3493b8738
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/utils/http/axios/index.ts

+ 2 - 1
src/utils/http/axios/index.ts

@@ -152,7 +152,8 @@ const transform: AxiosTransform = {
     }
     const params = config.params || {};
     const data = config.data || false;
-    if (config.method?.toUpperCase() === RequestEnum.GET) {
+    const method = config.method || 'GET';
+    if (method.toUpperCase() === RequestEnum.GET) {
       if (!isString(params)) {
         // 给 get 请求加上时间戳参数,避免从缓存中拿数据。
         config.params = Object.assign(params || {}, joinTimestamp(joinTime, false));