From 34c09fcea82e3529519a5acc563a22adcd5faae1 Mon Sep 17 00:00:00 2001 From: vben Date: Wed, 28 Oct 2020 23:00:03 +0800 Subject: [PATCH] fix: repair local development post request proxy to https error problem (#63) --- .env.development | 1 + CHANGELOG.zh_CN.md | 6 ++++++ package.json | 2 +- src/App.vue | 2 +- src/utils/http/axios/index.ts | 6 +++--- yarn.lock | 8 ++++---- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index 30f6b362..4dd7e787 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,7 @@ VITE_PUBLIC_PATH = / # Cross-domain proxy, you can configure multiple VITE_PROXY=[["/api","http://localhost:3000"]] +# VITE_PROXY=[["/api","https://vvbin.cn/test"]] # Delete console VITE_DROP_CONSOLE = false diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 048e125c..bd457f76 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -1,3 +1,9 @@ +## Wip + +### 🐛 Bug Fixes + +- 修复本地代理 post 接口到 https 地址超时错误 + ## 2.0.0-rc.6 (2020-10-28) ### ✨ Features diff --git a/package.json b/package.json index 6e9b1dff..7cc96a67 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "ts-node": "^9.0.0", "typescript": "^4.0.5", "vite-plugin-html": "^1.0.0-beta.2", - "vite-plugin-mock": "^1.0.4", + "vite-plugin-mock": "^1.0.6", "vite-plugin-purge-icons": "^0.4.4", "vite-plugin-pwa": "^0.1.2", "vue-eslint-parser": "^7.1.1", diff --git a/src/App.vue b/src/App.vue index 1059d2b2..92b6a482 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,7 +20,7 @@ moment.locale('zh-cn'); export default defineComponent({ - name: 'App1', + name: 'App', components: { ConfigProvider }, setup() { useInitAppConfigStore(); diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index b1dc9785..5d877959 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -116,20 +116,20 @@ const transform: AxiosTransform = { } else { // 兼容restful风格 config.url = config.url + config.params + `?_t=${now}`; - config.params = {}; + config.params = undefined; } } else { if (!isString(config.params)) { formatDate && formatRequestDate(config.params); config.data = config.params; - config.params = {}; + config.params = undefined; if (joinParamsToUrl) { config.url = setObjToUrlParams(config.url as string, config.data); } } else { // 兼容restful风格 config.url = config.url + config.params; - config.params = {}; + config.params = undefined; } } return config; diff --git a/yarn.lock b/yarn.lock index 45e46cf9..d51eb757 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7993,10 +7993,10 @@ vite-plugin-html@^1.0.0-beta.2: html-minifier-terser "^5.1.1" lodash "^4.17.20" -vite-plugin-mock@^1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/vite-plugin-mock/-/vite-plugin-mock-1.0.4.tgz#56631559afcd77046b058f162b2b5e8f5aaa7b17" - integrity sha512-jtos6ri0GAE/abv9VQyVvpPF5yQZaFx7vB7GV9wAZ5TQWqzH9nKUdmVj9ret7lC/oCnpaZn+2twxh4qzkVsd5Q== +vite-plugin-mock@^1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/vite-plugin-mock/-/vite-plugin-mock-1.0.6.tgz#4f47f193fd48a02c66641fc7242bd5329f99b471" + integrity sha512-+IeCiZBgQt2BpKKzYwoB5bWrrUwiksQh/9zWUrsegGw14PXmXtXXmgHr3CkKjyIChZmvuBs1BPieHD8SyBQAGQ== dependencies: "@rollup/plugin-node-resolve" "^9.0.0" chalk "^4.1.0" -- GitLab