Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →蓝鲸双协议兼容的 Axios 封装,自动处理旧版和新版 HTTP 协议
.claude/skills/tencentblueking-axios/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -30% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -30% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -63% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -43% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -59% | 0% |
蓝鲸体系处于 HTTP 协议升级过渡期,本封装自动兼容 旧版协议 和 新版协议。
src/api/http.ts 的实例发起data 字段typescript// src/api/http.ts import axios from 'axios'; import { Message } from 'bkui-vue'; const http = axios.create({ baseURL: '/api', timeout: 60000 }); http.interceptors.response.use( (res) => { const { data } = res; // 旧版协议(有 code 字段) if (data.code !== undefined) { if (data.code !== 0) { Message({ theme: 'error', message: data.message }); return Promise.reject(new Error(data.message)); } return data.data; } return data.data ?? data; }, (error) => { if (error.response?.status === 401) window.location.href = '/login'; Message({ theme: 'error', message: error.message }); return Promise.reject(error); } ); export default http;
| 错误 | 解决 | |------|------| | 401 循环跳转 | 登录页排除拦截器 | | 数据双层嵌套 | 删除多余的 .data |
| 资源 | URI | |-----|-----| | 完整实现 | skill://api-standard/references/full-implementation.md | | 协议迁移 | skill://api-standard/references/protocol-migration.md |
skill://api-standard/references/full-implementation.mdskill://api-standard/references/protocol-migration.mdskill://api-standard/assets/http.ts> 根据 SKILL.md 中的 IF-THEN 规则判断是否需要加载
Other measured skills in the registry, with their headline benchmark lift.