mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 18:10:21 +00:00
fix: add OpenAI version attribution header
This commit is contained in:
@@ -242,6 +242,7 @@ describe("OpenAIWebSocketManager", () => {
|
||||
expect(sock.options).toMatchObject({
|
||||
headers: expect.objectContaining({
|
||||
originator: "openclaw",
|
||||
version: expect.any(String),
|
||||
"User-Agent": expect.stringMatching(/^openclaw\//),
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -41,6 +41,7 @@ describe("extra-params: OpenAI attribution", () => {
|
||||
|
||||
expect(headers).toEqual({
|
||||
originator: "openclaw",
|
||||
version: "2026.3.22",
|
||||
"User-Agent": "openclaw/2026.3.22",
|
||||
});
|
||||
});
|
||||
@@ -61,6 +62,7 @@ describe("extra-params: OpenAI attribution", () => {
|
||||
|
||||
expect(headers).toEqual({
|
||||
originator: "openclaw",
|
||||
version: "2026.3.22",
|
||||
"User-Agent": "openclaw/2026.3.22",
|
||||
"X-Custom": "1",
|
||||
});
|
||||
@@ -89,6 +91,7 @@ describe("extra-params: OpenAI attribution", () => {
|
||||
|
||||
expect(headers).toEqual({
|
||||
originator: "openclaw",
|
||||
version: "2026.3.22",
|
||||
"User-Agent": "openclaw/2026.3.22",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,11 +64,13 @@ describe("provider attribution", () => {
|
||||
version: "2026.3.22",
|
||||
headers: {
|
||||
originator: "openclaw",
|
||||
version: "2026.3.22",
|
||||
"User-Agent": "openclaw/2026.3.22",
|
||||
},
|
||||
});
|
||||
expect(resolveProviderAttributionHeaders("openai", { OPENCLAW_VERSION: "2026.3.22" })).toEqual({
|
||||
originator: "openclaw",
|
||||
version: "2026.3.22",
|
||||
"User-Agent": "openclaw/2026.3.22",
|
||||
});
|
||||
});
|
||||
@@ -87,6 +89,7 @@ describe("provider attribution", () => {
|
||||
version: "2026.3.22",
|
||||
headers: {
|
||||
originator: "openclaw",
|
||||
version: "2026.3.22",
|
||||
"User-Agent": "openclaw/2026.3.22",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -74,6 +74,7 @@ function buildOpenAIAttributionPolicy(
|
||||
...identity,
|
||||
headers: {
|
||||
originator: OPENCLAW_ATTRIBUTION_ORIGINATOR,
|
||||
version: identity.version,
|
||||
"User-Agent": `${OPENCLAW_ATTRIBUTION_ORIGINATOR}/${identity.version}`,
|
||||
},
|
||||
};
|
||||
@@ -93,6 +94,7 @@ function buildOpenAICodexAttributionPolicy(
|
||||
...identity,
|
||||
headers: {
|
||||
originator: OPENCLAW_ATTRIBUTION_ORIGINATOR,
|
||||
version: identity.version,
|
||||
"User-Agent": `${OPENCLAW_ATTRIBUTION_ORIGINATOR}/${identity.version}`,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user