fix: remove undici fetch function
This commit is contained in:
@@ -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,
|
||||
{
|
||||
...init,
|
||||
dispatcher: proxyAgent,
|
||||
} as Parameters<typeof undiciFetch>[1] & {
|
||||
dispatcher: typeof proxyAgent;
|
||||
},
|
||||
);
|
||||
const response = await globalThis.fetch(input, {
|
||||
...init,
|
||||
dispatcher: proxyAgent,
|
||||
} 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@"
|
||||
}
|
||||
Reference in New Issue
Block a user