mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 08:16:50 +00:00
Merge pull request #726 from Kherrisan/main
feat: add support for setting the global fetch proxy through HTTP_PROXY
This commit is contained in:
10 files changed
+656
-50
No files matched your search
@@ -68,6 +68,12 @@ describe('Binary Downloader Proxy Support', () => {
|
||||
process.env.ALL_PROXY = 'http://allproxy:8080';
|
||||
expect(getProxyUrl(true)).toBe('http://allproxy:8080');
|
||||
});
|
||||
|
||||
it('should skip invalid HTTP_PROXY and fall back to ALL_PROXY', () => {
|
||||
process.env.HTTP_PROXY = 'not-a-valid-url';
|
||||
process.env.ALL_PROXY = 'http://allproxy:8080';
|
||||
expect(getProxyUrl(true)).toBe('http://allproxy:8080');
|
||||
});
|
||||
});
|
||||
|
||||
describe('HTTP requests', () => {
|
||||
@@ -91,6 +97,12 @@ describe('Binary Downloader Proxy Support', () => {
|
||||
expect(getProxyUrl(false)).toBe('http://allproxy:8080');
|
||||
});
|
||||
|
||||
it('should skip invalid HTTP_PROXY and use ALL_PROXY for HTTP', () => {
|
||||
process.env.HTTP_PROXY = 'not-a-valid-url';
|
||||
process.env.ALL_PROXY = 'http://allproxy:8080';
|
||||
expect(getProxyUrl(false)).toBe('http://allproxy:8080');
|
||||
});
|
||||
|
||||
it('should not use https_proxy for HTTP requests', () => {
|
||||
process.env.https_proxy = 'http://httpsproxy:8080';
|
||||
expect(getProxyUrl(false)).toBeUndefined();
|
||||
@@ -251,6 +263,11 @@ describe('Binary Downloader Proxy Support', () => {
|
||||
expect(getProxyAgent('https://example.com')).toBe(false);
|
||||
});
|
||||
|
||||
it('should keep supporting socks proxy URLs for downloader traffic', () => {
|
||||
process.env.https_proxy = 'socks5://proxy:1080';
|
||||
expect(getProxyAgent('https://example.com')).not.toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for invalid target URL', () => {
|
||||
process.env.https_proxy = 'http://proxy:8080';
|
||||
expect(getProxyAgent('not-a-url')).toBe(false);
|
||||
|
||||
Reference in new issue
Block a user