fix: correct proxy agent configuration and enhance testing
This commit is contained in:
parent
aa099bad37
commit
72038d9ad1
3 changed files with 225 additions and 73 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue