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