docs: 更新known-patterns.json - 添加API路径双重/api问题模式
新增 pat-003: API路径双重/api前缀问题 - baseURL和API路径都包含/api导致请求变成/api/api/xxx - 质量规则:baseURL不含/api,API路径使用/api/xxx
This commit is contained in:
parent
2d0f9bf5e0
commit
dcbcbc51ef
|
|
@ -33,6 +33,22 @@
|
|||
]
|
||||
},
|
||||
"pat-003": {
|
||||
"name": "API路径双重/api前缀问题",
|
||||
"source": "implementation_review",
|
||||
"confidence": 0.95,
|
||||
"applications": 2,
|
||||
"created": "2026-03-22",
|
||||
"category": "frontend",
|
||||
"pattern": "baseURL和API路径都包含/api,导致请求变成/api/api/xxx",
|
||||
"problem": "后端收到/api/api/permissions请求,返回NoResourceFoundException",
|
||||
"solution": "baseURL设置为http://localhost:8080(不含/api),API路径使用/api/permissions",
|
||||
"quality_rules": [
|
||||
"baseURL: http://localhost:8080",
|
||||
"API路径: /api/permissions, /api/users 等",
|
||||
"不要在baseURL和API路径中同时包含/api"
|
||||
]
|
||||
},
|
||||
"pat-004": {
|
||||
"name": "CORS配置端口限制",
|
||||
"source": "implementation_review",
|
||||
"confidence": 0.85,
|
||||
|
|
@ -43,11 +59,10 @@
|
|||
"problem": "前端使用不同端口时API请求被CORS阻止",
|
||||
"solution": "CORS配置中添加所有可能的前端开发端口(5173-5180)",
|
||||
"quality_rules": [
|
||||
"后端CorsConfiguration设置allowedOrigins包含所有开发端口",
|
||||
"前端request.ts的baseURL使用绝对路径http://localhost:8080/api"
|
||||
"后端CorsConfiguration设置allowedOrigins包含所有开发端口"
|
||||
]
|
||||
},
|
||||
"pat-004": {
|
||||
"pat-005": {
|
||||
"name": "Git提交纪律",
|
||||
"source": "user_feedback",
|
||||
"confidence": 0.95,
|
||||
|
|
@ -63,7 +78,7 @@
|
|||
"在git commit之前不要进行npm install等可能重置环境的操作"
|
||||
]
|
||||
},
|
||||
"pat-005": {
|
||||
"pat-006": {
|
||||
"name": "登录跳转使用window.location.href",
|
||||
"source": "implementation_review",
|
||||
"confidence": 0.90,
|
||||
|
|
@ -78,7 +93,7 @@
|
|||
"登出时也使用window.location.href = '/login'"
|
||||
]
|
||||
},
|
||||
"pat-006": {
|
||||
"pat-007": {
|
||||
"name": "dist构建产物未及时更新",
|
||||
"source": "user_feedback",
|
||||
"confidence": 0.80,
|
||||
|
|
|
|||
Loading…
Reference in New Issue