work on proxy service

This commit is contained in:
Bojan Kucera 2025-06-07 18:04:20 -04:00
parent baa34a3805
commit 81d88357ca
5 changed files with 204 additions and 547 deletions

View file

@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach, beforeAll, afterAll } from 'bun:test';
import { HttpClient, HttpError, ProxyManager } from '../src/index.js';
import type { ProxyConfig } from '../src/types.js';
import type { ProxyInfo } from '../src/types.js';
import { MockServer } from './mock-server.js';
// Global mock server instance
@ -119,13 +119,13 @@ describe('HttpClient', () => {
describe('ProxyManager', () => {
test('should determine when to use Bun fetch', () => {
const httpProxy: ProxyConfig = {
const httpProxy: ProxyInfo = {
protocol: 'http',
host: 'proxy.example.com',
port: 8080
};
const socksProxy: ProxyConfig = {
const socksProxy: ProxyInfo = {
protocol: 'socks5',
host: 'proxy.example.com',
port: 1080
@ -136,7 +136,7 @@ describe('ProxyManager', () => {
});
test('should create proxy URL for Bun fetch', () => {
const proxy: ProxyConfig = {
const proxy: ProxyInfo = {
protocol: 'http',
host: 'proxy.example.com',
port: 8080,
@ -149,7 +149,7 @@ describe('ProxyManager', () => {
});
test('should create proxy URL without credentials', () => {
const proxy: ProxyConfig = {
const proxy: ProxyInfo = {
protocol: 'https',
host: 'proxy.example.com',
port: 8080