()
| 270 | var httpClient *http.Client |
| 271 | |
| 272 | func HttpClient() *http.Client { |
| 273 | once.Do(func() { |
| 274 | httpClient = NewHttpClient() |
| 275 | httpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error { |
| 276 | if len(via) >= 10 { |
| 277 | return errors.New("stopped after 10 redirects") |
| 278 | } |
| 279 | req.Header.Del("Referer") |
| 280 | return nil |
| 281 | } |
| 282 | }) |
| 283 | return httpClient |
| 284 | } |
| 285 | |
| 286 | func NewHttpClient() *http.Client { |
| 287 | transport := &http.Transport{ |
no test coverage detected