added ProxyRetry to config and fixed ProxyStrict
Some checks failed
Run Integration Tests / test (push) Failing after 50s
Some checks failed
Run Integration Tests / test (push) Failing after 50s
This commit is contained in:
parent
ab707a91e8
commit
35e657bccd
17 changed files with 224 additions and 186 deletions
|
@ -25,27 +25,18 @@ func PerformBraveTextSearch(query, safe, lang string, offset int) ([]TextSearchR
|
|||
return nil, 0, fmt.Errorf("creating request: %v", err)
|
||||
}
|
||||
|
||||
// Set headers including User-Agent
|
||||
TextUserAgent, err := GetUserAgent("Text-Search")
|
||||
TextUserAgent, err := GetUserAgent("Text-Search-Brave")
|
||||
if err != nil {
|
||||
printWarn("Error generating User-Agent: %v", err)
|
||||
return nil, 0, err
|
||||
}
|
||||
req.Header.Set("User-Agent", TextUserAgent)
|
||||
|
||||
var resp *http.Response
|
||||
|
||||
// Determine whether to use a proxy client or a default client
|
||||
if config.MetaProxyEnabled && metaProxyClient != nil {
|
||||
resp, err = metaProxyClient.Do(req)
|
||||
} else {
|
||||
client := &http.Client{}
|
||||
resp, err = client.Do(req)
|
||||
}
|
||||
|
||||
// Single call to DoMetaProxyRequest:
|
||||
resp, err := DoMetaProxyRequest(req)
|
||||
if err != nil {
|
||||
printWarn("Error performing request: %v", err)
|
||||
return nil, 0, fmt.Errorf("performing request: %v", err)
|
||||
return nil, 0, fmt.Errorf("performing meta-request: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue