mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-15 19:32:20 +03:00
The service operator asked in writing (2026-08-30) that their service be removed from OmniRoute entirely: executor, registry entry, no-auth catalog entry and alias, icon mapping, env var, docs rows, dedicated tests and snapshots, and every passing mention in comments, fixtures and CHANGELOG entries. Provider count drops from 355 to 354 on every canonical surface. Co-authored-by: Markus Hartung <diegosouzapw@users.noreply.github.com>
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { BaseExecutor } from "../../open-sse/executors/base.ts";
|
|
|
|
/**
|
|
* Generic BaseExecutor consumer — no buildHeaders() override — representing
|
|
* every provider (xai, cliproxyapi, chipotle, mimocode, ninerouter,
|
|
* gitlab, ...) that relies on BaseExecutor.buildHeaders() as-is.
|
|
*
|
|
* Regression guard for #8467/#8493: resolveEffectiveKey() already rotates to
|
|
* an extra key when the primary apiKey is empty, but the header-write gate in
|
|
* buildHeaders() tested the raw `credentials.apiKey` instead of the resolved
|
|
* `effectiveKey` — so with an empty primary + populated extras, no
|
|
* Authorization header was ever written, even though a valid key existed.
|
|
*/
|
|
class GenericExecutor extends BaseExecutor {
|
|
constructor() {
|
|
super("generic-provider", {
|
|
baseUrls: ["https://default.example/v1/chat/completions"],
|
|
});
|
|
}
|
|
|
|
async transformRequest(model: string, body: unknown, stream: boolean) {
|
|
return body;
|
|
}
|
|
}
|
|
|
|
test("buildHeaders: writes Authorization from the rotated extra key when primary apiKey is empty (#8467/#8493)", () => {
|
|
const executor = new GenericExecutor();
|
|
const headers = executor.buildHeaders({
|
|
apiKey: "",
|
|
connectionId: "generic-empty-primary",
|
|
providerSpecificData: { extraApiKeys: ["sk-extra-only"] },
|
|
});
|
|
|
|
assert.equal(headers["Authorization"], "Bearer sk-extra-only");
|
|
});
|