Skip to content

Commit 8195914

Browse files
committed
test(auth): 添加 openApiSource 头和相关测试字段
- 在请求和响应处理中新增 openApiSource 字段 - 更新 e2e 测试以包含 openApiSource 字段验证 - 确保请求头包含 x-dashscope-openapisource 信息 - 在测试数据中添加 openApiSource 的示例值 BailianCLI
1 parent 4343fc8 commit 8195914

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/commands/tests/e2e/auth.e2e.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface ValidationServer {
2020
body: Record<string, unknown>;
2121
authorization?: string;
2222
sourceConfig?: string;
23+
openApiSource?: string;
2324
}>;
2425
close(): Promise<void>;
2526
}
@@ -36,6 +37,7 @@ async function startValidationServer(statusCode = 200): Promise<ValidationServer
3637
body: rawBody ? (JSON.parse(rawBody) as Record<string, unknown>) : {},
3738
authorization: request.headers.authorization,
3839
sourceConfig: request.headers["x-dashscope-source-config"] as string | undefined,
40+
openApiSource: request.headers["x-dashscope-openapisource"] as string | undefined,
3941
});
4042
response.writeHead(statusCode, { "Content-Type": "application/json" });
4143
if (statusCode >= 400) {
@@ -216,6 +218,7 @@ describe("e2e: auth", () => {
216218
path: "/compatible-mode/v1/chat/completions",
217219
authorization: "Bearer sk-e2e-placeholder",
218220
sourceConfig: expect.any(String),
221+
openApiSource: "BailianCLI",
219222
body: {
220223
model: "qwen3.8-max",
221224
stream: false,
@@ -313,6 +316,7 @@ describe("e2e: auth", () => {
313316
path: "/compatible-mode/v1/chat/completions",
314317
authorization: "Bearer sk-sp-e2e-placeholder",
315318
sourceConfig: expect.any(String),
319+
openApiSource: "BailianCLI",
316320
body: {
317321
model: "qwen3.8-max",
318322
stream: false,

0 commit comments

Comments
 (0)