1
0
forked from boos/BoosAPI

fix: support oauth route unit inserts on postgres (#443)

* fix proxy debug undici response header capture

* fix: support oauth route unit inserts on postgres
This commit is contained in:
Cita
2026-04-06 13:39:05 +08:00
committed by GitHub
parent 2b9200ea7c
commit d1b42b2236
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -81,6 +81,29 @@ describe('db proxy query wrapper', () => {
});
});
it('normalizes postgres inserts with returning ids for oauth route units', async () => {
const query = vi.fn(async () => ({
rows: [{ id: 7 }],
rowCount: 1,
}));
const executor = { query };
const result = await testUtils.pgProxyQuery(
executor as any,
'insert into "oauth_route_units" ("site_id", "provider", "name") values ($1, $2, $3)',
[1, 'codex', 'pool-a'],
'execute',
);
expect(query).toHaveBeenCalledWith({
text: 'insert into "oauth_route_units" ("site_id", "provider", "name") values ($1, $2, $3) returning id',
values: [1, 'codex', 'pool-a'],
});
expect(result).toEqual({
rows: [{ changes: 1, lastInsertRowid: 7 }],
});
});
it('builds mysql pool options with jsonStrings enabled', () => {
expect(testUtils.buildMysqlPoolOptions('mysql://root:pass@db.example.com:3306/metapi', false)).toMatchObject({
uri: 'mysql://root:pass@db.example.com:3306/metapi',
+2
View File
@@ -33,6 +33,8 @@ const TABLES_WITH_NUMERIC_ID = new Set([
'token_routes',
'route_group_sources',
'route_channels',
'oauth_route_units',
'oauth_route_unit_members',
'proxy_logs',
'proxy_debug_traces',
'proxy_debug_attempts',