fix: remove undici fetch function

This commit is contained in:
2026-10-23 19:47:03 +03:30
parent 97b1e48cfd
commit e48b6c5460
5 changed files with 14 additions and 17 deletions
+1 -1
View File
@@ -6,6 +6,6 @@
"baseUrl": "http://localhost:3000"
},
"prod": {
"baseUrl": "http://localhost:3000"
"baseUrl": "https://api-dev.healahealth.app/v1"
}
}
@@ -24,7 +24,7 @@ export class OpenRouterService implements OnModuleDestroy {
}
private async createOpenRouter() {
const { ProxyAgent, fetch: undiciFetch } = await import('undici');
const { ProxyAgent } = await import('undici');
const { HTTPClient, OpenRouter } = await import('@openrouter/sdk');
const env = this.configService.get<string>('app.environment');
@@ -58,17 +58,14 @@ export class OpenRouterService implements OnModuleDestroy {
try {
const httpClient = new HTTPClient({
fetcher: async (input, init) => {
const response = await undiciFetch(
input as string | URL,
{
const response = await globalThis.fetch(input, {
...init,
dispatcher: proxyAgent,
} as Parameters<typeof undiciFetch>[1] & {
} as RequestInit & {
dispatcher: typeof proxyAgent;
},
);
});
return response as unknown as Response;
return response;
},
});
@@ -3,7 +3,7 @@ Content-Type: application/json
lang: fa
{
"phone": "09333026363",
"phone": "09121212123",
"password": "Password1@"
}
@@ -2,8 +2,8 @@ POST {{baseUrl}}/auth/verify-otp
Content-Type: application/json
{
"phone": "09333026363",
"otp": "50226"
"phone": "09121212123",
"otp": "71288"
}
{{
@@ -4,8 +4,8 @@ Authorization: Bearer {{$global.accessToken}}
lang: fa
{
"firstName": "رادمهر",
"lastName": "ترناس",
"firstName": "تست",
"lastName": "تستعلی",
"password": "Password1@",
"confirmPassword": "Password1@"
}