mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
test: expand shouldBypassProxy coverage for wildcard, IPv6, and edge cases (#10723)
* Initial plan * test: add shouldBypassProxy coverage for wildcard, ipv6 port and edge cases Agent-Logs-Url: https://github.com/axios/axios/sessions/2986cafc-965b-4aea-b076-60f954e7eba5 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -73,4 +73,31 @@ describe('helpers::shouldBypassProxy', () => {
|
|||||||
expect(shouldBypassProxy('http://localhost:8080/')).toBe(true);
|
expect(shouldBypassProxy('http://localhost:8080/')).toBe(true);
|
||||||
expect(shouldBypassProxy('http://localhost:8081/')).toBe(false);
|
expect(shouldBypassProxy('http://localhost:8081/')).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should bypass proxy for any host when no_proxy is *', () => {
|
||||||
|
setNoProxy('*');
|
||||||
|
|
||||||
|
expect(shouldBypassProxy('http://example.com/')).toBe(true);
|
||||||
|
expect(shouldBypassProxy('http://localhost:1234/')).toBe(true);
|
||||||
|
expect(shouldBypassProxy('http://[::1]:8080/')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should support bracketed ipv6 with explicit port in no_proxy', () => {
|
||||||
|
setNoProxy('[::1]:8080');
|
||||||
|
|
||||||
|
expect(shouldBypassProxy('http://[::1]:8080/')).toBe(true);
|
||||||
|
expect(shouldBypassProxy('http://[::1]:8081/')).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not bypass when no_proxy is empty', () => {
|
||||||
|
setNoProxy('');
|
||||||
|
|
||||||
|
expect(shouldBypassProxy('http://localhost:8080/')).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not bypass for malformed URLs', () => {
|
||||||
|
setNoProxy('localhost,127.0.0.1,::1');
|
||||||
|
|
||||||
|
expect(shouldBypassProxy('not a url')).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user