fix: Vite type declaration, non-idempotent retry, hardcoded test IP

- Add frontend/src/vite-env.d.ts (reference vite/client) to fix vue-tsc build
- Restrict axios-retry to GET/HEAD/OPTIONS only (avoid replaying mutations)
- Convert test_upstream.py to accept URL via CLI args instead of hardcoded IP
This commit is contained in:
SmartUp Developer
2026-05-17 11:56:49 +08:00
parent 2934473770
commit 5c60627fb6
3 changed files with 18 additions and 7 deletions
+6 -3
View File
@@ -11,14 +11,17 @@ export const api = axios.create({
axiosRetry(api, {
retries: 3,
retryDelay: axiosRetry.exponentialDelay,
onRetry: (_retryCount, _err, _requestConfig) => {
// no-op — could log in dev
},
// Only retry idempotent methods — never retry POST/PUT/PATCH/DELETE
retryCondition: (err) => {
const method = (err.config?.method ?? '').toUpperCase()
if (!['GET', 'HEAD', 'OPTIONS'].includes(method)) return false
// Retry on network errors or 5xx, but never on 401/403/404/4xx
if (!err.response) return true
return err.response.status >= 500 && err.response.status < 600
},
onRetry: (_retryCount, _err, _requestConfig) => {
// no-op — could log in dev
},
})
api.interceptors.response.use(