Skip to content

Commit 4c10df6

Browse files
committed
chore: double override fetch
1 parent 819c189 commit 4c10df6

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

packages/consumption/src/modules/openid4vc/local/LocalAgentDependencies.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
import { AgentDependencies } from "@credo-ts/core";
23
import { EventEmitter } from "events";
34
import { fetch as undiciFetch } from "undici";
@@ -9,7 +10,22 @@ export const agentDependencies: AgentDependencies = {
910
FileSystem: EnmeshedHolderFileSystem,
1011
// eslint-disable-next-line @typescript-eslint/naming-convention
1112
EventEmitterClass: EventEmitter,
12-
fetch: undiciFetch as typeof fetch,
13+
fetch: (async (input, init) => {
14+
console.log("############### agentDependencies-fetch-input #################", input);
15+
console.log("############### agentDependencies-fetch-init #################", init);
16+
17+
try {
18+
const response = await undiciFetch(input as any, init as any);
19+
20+
console.log("############### agentDependencies-fetch-response #################", response);
21+
22+
return response;
23+
} catch (error) {
24+
console.error("############### agentDependencies-fetch-error #################", error);
25+
console.error("############### agentDependencies-fetch-error-stack #################", (error as any).stack);
26+
throw error;
27+
}
28+
}) as typeof fetch,
1329
// eslint-disable-next-line @typescript-eslint/naming-convention
1430
WebSocketClass: webSocket
1531
};

packages/runtime/test/consumption/openid4vc.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,9 @@ beforeAll(async () => {
2222
"Content-Type": "application/json" // eslint-disable-line @typescript-eslint/naming-convention
2323
}
2424
});
25-
let healthCheckResult = await axiosInstance.get("/health");
26-
while (healthCheckResult.status !== 200) {
27-
await new Promise((resolve) => setTimeout(resolve, 1000));
28-
healthCheckResult = await axiosInstance.get("/health");
29-
}
3025
}, 120000);
3126

3227
afterAll(async () => {
33-
const healthCheckResult = await axiosInstance.get("/health");
34-
console.log(healthCheckResult); // eslint-disable-line no-console
3528
await runtimeServiceProvider.stop();
3629
});
3730

0 commit comments

Comments
 (0)