Skip to content

Commit 860df03

Browse files
Alix-007ruomuxydt
authored andcommitted
test(anthropic): assert OAuth user-agent carries resolved version
Strengthen the transport-stream OAuth user-agent assertion to verify the header matches claude-cli/<semver> instead of only the prefix, so a regression to an empty or malformed version string is caught.
1 parent d9bd022 commit 860df03

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/agents/anthropic-transport-stream.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,9 @@ describe("anthropic transport stream", () => {
921921
const headers = new Headers(init?.headers);
922922
expect(headers.get("authorization")).toBe("Bearer sk-ant-oat-example");
923923
expect(headers.get("x-app")).toBe("cli");
924-
expect(headers.get("user-agent")).toContain("claude-cli/");
924+
// The OAuth user-agent must carry the resolved Claude Code version, not an
925+
// empty or malformed value, so a stale hardcoded constant cannot regress.
926+
expect(headers.get("user-agent")).toMatch(/^claude-cli\/\d+\.\d+\.\d+/);
925927
const firstCallParams = latestAnthropicRequest().payload;
926928
const system = requireArray(firstCallParams.system, "system");
927929
expect(

0 commit comments

Comments
 (0)