fix: correct proxy agent configuration and enhance testing

This commit is contained in:
badblocks 2025-07-29 16:49:43 -07:00
parent aa099bad37
commit 72038d9ad1
No known key found for this signature in database
3 changed files with 225 additions and 73 deletions

View file

@ -1,14 +1,14 @@
import { ProxyAgent } from "undici";
const proxyAgent = new ProxyAgent("http://wireguard:8888");
const REQUEST_TIMEOUT = 5000;
const REQUEST_TIMEOUT = 15000;
export const httpFetchClient = {
get: async (url, headers) => {
const response = await $fetch(url, {
method: "GET",
headers,
agent: proxyAgent,
dispatcher: proxyAgent,
timeout: REQUEST_TIMEOUT,
});
return response;
@ -18,7 +18,7 @@ export const httpFetchClient = {
method: "POST",
headers: { "Content-Type": "application/json", ...headers },
body: JSON.stringify(body),
agent: proxyAgent,
dispatcher: proxyAgent,
timeout: REQUEST_TIMEOUT,
});
return response;