mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 22:17:20 +00:00
fix(cliproxy): prevent false remote timeout on reachable proxy
This commit is contained in:
1 parent
dcdb2f6284
commit
34292ca7f8
2 files changed
+41
-31
No files matched your search
@@ -2,9 +2,9 @@
|
||||
* Unit tests for remote-proxy-client module
|
||||
*/
|
||||
import { describe, it, expect } from 'bun:test';
|
||||
import type {
|
||||
RemoteProxyClientConfig,
|
||||
RemoteProxyStatus,
|
||||
import {
|
||||
type RemoteProxyClientConfig,
|
||||
type RemoteProxyStatus,
|
||||
} from '../../../src/cliproxy/remote-proxy-client';
|
||||
|
||||
// We test the module's type exports and error handling logic
|
||||
@@ -119,15 +119,15 @@ describe('remote-proxy-client', () => {
|
||||
});
|
||||
|
||||
describe('health check URL construction', () => {
|
||||
// CLIProxyAPI uses /v1/models for health checks (no /health endpoint)
|
||||
it('should construct correct health check URL pattern using /v1/models', () => {
|
||||
// CLIProxyAPI uses root endpoint for liveness checks (no /health endpoint)
|
||||
it('should construct correct health check URL pattern using /', () => {
|
||||
const config: RemoteProxyClientConfig = {
|
||||
host: '192.168.1.100',
|
||||
port: 8317,
|
||||
protocol: 'http',
|
||||
};
|
||||
const expectedUrl = `${config.protocol}://${config.host}:${config.port}/v1/models`;
|
||||
expect(expectedUrl).toBe('http://192.168.1.100:8317/v1/models');
|
||||
const expectedUrl = `${config.protocol}://${config.host}:${config.port}/`;
|
||||
expect(expectedUrl).toBe('http://192.168.1.100:8317/');
|
||||
});
|
||||
|
||||
it('should construct HTTPS URL when protocol is https', () => {
|
||||
@@ -136,8 +136,8 @@ describe('remote-proxy-client', () => {
|
||||
port: 443,
|
||||
protocol: 'https',
|
||||
};
|
||||
const expectedUrl = `${config.protocol}://${config.host}:${config.port}/v1/models`;
|
||||
expect(expectedUrl).toBe('https://secure.example.com:443/v1/models');
|
||||
const expectedUrl = `${config.protocol}://${config.host}:${config.port}/`;
|
||||
expect(expectedUrl).toBe('https://secure.example.com:443/');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user