mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-19 16:28:28 +00:00
fix comment
This commit is contained in:
parent
bba3ab93b1
commit
588ef60411
2 changed files with 26 additions and 1 deletions
|
|
@ -77,4 +77,28 @@ describe('normalizeProxyUrl', () => {
|
|||
it('should handle IPv6 addresses with http:// prefix', () => {
|
||||
expect(normalizeProxyUrl('http://[::1]:8080')).toBe('http://[::1]:8080');
|
||||
});
|
||||
|
||||
it('should not modify URL that already has socks:// prefix', () => {
|
||||
expect(normalizeProxyUrl('socks://proxy.example.com:1080')).toBe(
|
||||
'socks://proxy.example.com:1080',
|
||||
);
|
||||
});
|
||||
|
||||
it('should not modify URL that already has socks4:// prefix', () => {
|
||||
expect(normalizeProxyUrl('socks4://proxy.example.com:1080')).toBe(
|
||||
'socks4://proxy.example.com:1080',
|
||||
);
|
||||
});
|
||||
|
||||
it('should not modify URL that already has socks5:// prefix', () => {
|
||||
expect(normalizeProxyUrl('socks5://proxy.example.com:1080')).toBe(
|
||||
'socks5://proxy.example.com:1080',
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle SOCKS:// prefix (case insensitive)', () => {
|
||||
expect(normalizeProxyUrl('SOCKS5://proxy.example.com:1080')).toBe(
|
||||
'SOCKS5://proxy.example.com:1080',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ export function normalizeProxyUrl(
|
|||
}
|
||||
|
||||
// Check if the URL already has a protocol prefix
|
||||
if (/^https?:\/\//i.test(trimmed)) {
|
||||
// Support http, https, socks, socks4, socks5 protocols
|
||||
if (/^(https?|socks[45]?):\/\//i.test(trimmed)) {
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue