fix(web-search): honor HTTP_PROXY environment variable for Brave Search API
The web_search tool was not respecting HTTP_PROXY/HTTPS_PROXY environment variables, causing 'fetch failed' errors when running behind a proxy. This fix adds ProxyAgent support for the Brave Search API, similar to how other tools in OpenClaw handle proxy configuration. Fixes #27405
This commit is contained in:
committed by
Peter Steinberger
parent
9925ac6a2d
commit
d8e2030d47
@@ -1248,13 +1248,18 @@ async function runWebSearch(params: {
|
||||
url.searchParams.set("freshness", params.freshness);
|
||||
}
|
||||
|
||||
const res = await fetch(url.toString(), {
|
||||
// Resolve proxy from environment variables
|
||||
const proxyUrl = resolveProxyUrl();
|
||||
const dispatcher = proxyUrl ? new ProxyAgent(proxyUrl) : undefined;
|
||||
|
||||
const res = await undiciFetch(url.toString(), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"X-Subscription-Token": params.apiKey,
|
||||
},
|
||||
signal: withTimeout(undefined, params.timeoutSeconds * 1000),
|
||||
...(dispatcher ? { dispatcher } : {}),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user