- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
/**
|
||
* TC-COMPAT-006 · 标准格式数据可交换
|
||
* Q-COMPAT 兼容性 · 正向 · P1
|
||
* 预期:系统提供的数据交换格式符合相关国际/国家/行业/企业标准
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-COMPAT-006',
|
||
req: 'Q-COMPAT',
|
||
title: '标准格式数据可交换',
|
||
type: '正向',
|
||
priority: 'P1',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
// 接口遵循 JSON over HTTP,Content-Type 标准
|
||
const r = await fetch('http://localhost:30000/api/oauth/CurrentUser', {
|
||
headers: { Authorization: 'bearer fake' }
|
||
})
|
||
const ct = r.headers.get('content-type') || ''
|
||
t.assert(/application\/json/i.test(ct), `Content-Type 为 JSON(实际「${ct}」)`)
|
||
// 跨域/CORS:内网/同源 API 不一定返回 CORS 头,缺失不算缺陷;有则须为 * 或具体源
|
||
const cors = r.headers.get('access-control-allow-origin') || ''
|
||
if (cors) {
|
||
t.assert(cors === '*' || cors.startsWith('http'), `CORS 头存在(${cors})`)
|
||
} else {
|
||
t.log(' ℹ CORS 头未返回(同源/内网 API 无需跨域,跳过校验)')
|
||
}
|
||
await t.login()
|
||
const json = await t.api('GET', '/api/ssw/tds/Space?currentPage=1&pageSize=1')
|
||
t.assert(json.code === 200, `分页接口符合 ActionResult 标准包(code=${json.code})`)
|
||
} |