test(auth): 添加 openApiSource 头和相关测试字段

- 在请求和响应处理中新增 openApiSource 字段
- 更新 e2e 测试以包含 openApiSource 字段验证
- 确保请求头包含 x-dashscope-openapisource 信息
- 在测试数据中添加 openApiSource 的示例值 BailianCLI
This commit is contained in:
zeyu.fz
2026-08-11 14:23:01 +08:00
parent 4343fc87af
commit 81959145d7
@@ -20,6 +20,7 @@ interface ValidationServer {
body: Record<string, unknown>;
authorization?: string;
sourceConfig?: string;
openApiSource?: string;
}>;
close(): Promise<void>;
}
@@ -36,6 +37,7 @@ async function startValidationServer(statusCode = 200): Promise<ValidationServer
body: rawBody ? (JSON.parse(rawBody) as Record<string, unknown>) : {},
authorization: request.headers.authorization,
sourceConfig: request.headers["x-dashscope-source-config"] as string | undefined,
openApiSource: request.headers["x-dashscope-openapisource"] as string | undefined,
});
response.writeHead(statusCode, { "Content-Type": "application/json" });
if (statusCode >= 400) {
@@ -216,6 +218,7 @@ describe("e2e: auth", () => {
path: "/compatible-mode/v1/chat/completions",
authorization: "Bearer sk-e2e-placeholder",
sourceConfig: expect.any(String),
openApiSource: "BailianCLI",
body: {
model: "qwen3.8-max",
stream: false,
@@ -313,6 +316,7 @@ describe("e2e: auth", () => {
path: "/compatible-mode/v1/chat/completions",
authorization: "Bearer sk-sp-e2e-placeholder",
sourceConfig: expect.any(String),
openApiSource: "BailianCLI",
body: {
model: "qwen3.8-max",
stream: false,