forked from boos/BoosAPI
fix codex compact non-stream accept header (#439)
This commit is contained in:
@@ -20,6 +20,7 @@ export const codexProviderProfile: ProviderProfile = {
|
||||
const headers = buildCodexRuntimeHeaders({
|
||||
baseHeaders: input.baseHeaders,
|
||||
providerHeaders: input.providerHeaders,
|
||||
stream: input.stream,
|
||||
explicitSessionId: asTrimmedString(input.codexExplicitSessionId) || null,
|
||||
continuityKey: asTrimmedString(input.codexSessionCacheKey) || null,
|
||||
userAgentOverride: configuredUserAgent || null,
|
||||
|
||||
@@ -61,6 +61,7 @@ describe('provider header utils', () => {
|
||||
originator: 'codex_cli_rs',
|
||||
'chatgpt-account-id': 'acct-1',
|
||||
},
|
||||
stream: false,
|
||||
continuityKey: 'cache-key-1',
|
||||
explicitSessionId: null,
|
||||
});
|
||||
@@ -70,7 +71,7 @@ describe('provider header utils', () => {
|
||||
expect(headers['Chatgpt-Account-Id']).toBe('acct-1');
|
||||
expect(headers.Session_id).toMatch(/^[0-9a-f-]{36}$/);
|
||||
expect(headers.Conversation_id).toBe(headers.Session_id);
|
||||
expect(headers.Accept).toBe('text/event-stream');
|
||||
expect(headers.Accept).toBe('application/json');
|
||||
});
|
||||
|
||||
it('builds claude runtime headers with merged betas and oauth bearer auth', async () => {
|
||||
|
||||
@@ -114,6 +114,7 @@ function asTrimmedString(value: unknown): string {
|
||||
export function buildCodexRuntimeHeaders(input: {
|
||||
baseHeaders: Record<string, string>;
|
||||
providerHeaders?: Record<string, string>;
|
||||
stream?: boolean;
|
||||
explicitSessionId?: string | null;
|
||||
continuityKey?: string | null;
|
||||
versionDefault?: string;
|
||||
@@ -177,7 +178,7 @@ export function buildCodexRuntimeHeaders(input: {
|
||||
Session_id: sessionId,
|
||||
...(conversationId ? { Conversation_id: conversationId } : {}),
|
||||
'User-Agent': userAgent,
|
||||
Accept: 'text/event-stream',
|
||||
Accept: input.stream === false ? 'application/json' : 'text/event-stream',
|
||||
Connection: 'Keep-Alive',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -362,6 +362,7 @@ describe('responses proxy compact upstream routing', () => {
|
||||
expect(forwardedBody.stream_options).toBeUndefined();
|
||||
expect(forwardedBody.instructions).toBe('');
|
||||
expect(forwardedBody.store).toBe(false);
|
||||
expect(options.headers.Accept || options.headers.accept).toBe('application/json');
|
||||
});
|
||||
|
||||
it('preserves native response.compaction payloads instead of coercing them into object=response', async () => {
|
||||
|
||||
@@ -815,7 +815,7 @@ describe('buildUpstreamEndpointRequest', () => {
|
||||
expect(request.headers.Session_id).toMatch(/^[0-9a-f-]{36}$/i);
|
||||
expect(request.headers.Conversation_id).toBe(request.headers.Session_id);
|
||||
expect(request.headers['User-Agent']).toBe('codex_cli_rs/0.101.0 (Mac OS 26.0.1; arm64) Apple_Terminal/464');
|
||||
expect(request.headers.Accept).toBe('text/event-stream');
|
||||
expect(request.headers.Accept).toBe('application/json');
|
||||
expect(request.headers.Connection).toBe('Keep-Alive');
|
||||
expect(request.body.instructions).toBe('');
|
||||
expect(request.body.prompt_cache_key).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user