From b8e36b483ebc3033e8010fe652f4467e89abf70b Mon Sep 17 00:00:00 2001 From: liwei Date: Wed, 1 May 2024 18:23:32 +0800 Subject: [PATCH] fix: test --- internal/protocol/http/fetcher.go | 5 +++-- pkg/download/engine/inject/xhr/module.go | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/protocol/http/fetcher.go b/internal/protocol/http/fetcher.go index 5369bc1b..bda1a457 100644 --- a/internal/protocol/http/fetcher.go +++ b/internal/protocol/http/fetcher.go @@ -451,10 +451,11 @@ func (f *Fetcher) splitChunk() (chunks []*chunk) { } func (f *Fetcher) buildClient() *http.Client { - transport := &http.Transport{} + transport := &http.Transport{ + Proxy: f.ctl.ProxyConfig.ToHandler(), + } // Cookie handle jar, _ := cookiejar.New(nil) - transport.Proxy = f.ctl.ProxyConfig.ToHandler() return &http.Client{ Transport: transport, Jar: jar, diff --git a/pkg/download/engine/inject/xhr/module.go b/pkg/download/engine/inject/xhr/module.go index d43491a2..dd6e0a77 100644 --- a/pkg/download/engine/inject/xhr/module.go +++ b/pkg/download/engine/inject/xhr/module.go @@ -203,11 +203,8 @@ func (xhr *XMLHttpRequest) Send(data goja.Value) { for k, v := range xhr.requestHeaders { req.Header.Set(k, v) } - var transport *http.Transport - if xhr.proxyHandler != nil { - transport = &http.Transport{ - Proxy: xhr.proxyHandler, - } + transport := &http.Transport{ + Proxy: xhr.proxyHandler, } client := &http.Client{ Transport: transport,