fix: keep Matrix transport tests on mocked fetch

This commit is contained in:
Peter Steinberger
2026-04-17 17:33:29 +01:00
parent 8caad53f57
commit 7815d25eef
3 changed files with 7 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
import { fetchWithRuntimeDispatcher, isMockedFetch } from "openclaw/plugin-sdk/runtime-fetch";
import {
closeDispatcher,
createPinnedDispatcher,
@@ -11,6 +11,7 @@ export {
closeDispatcher,
createPinnedDispatcher,
fetchWithRuntimeDispatcher,
isMockedFetch,
resolvePinnedHostnameWithPolicy,
type PinnedDispatcherPolicy,
type SsrFPolicy,

View File

@@ -5,6 +5,7 @@ import {
closeDispatcher,
createPinnedDispatcher,
resolvePinnedHostnameWithPolicy,
isMockedFetch,
type SsrFPolicy,
fetchWithRuntimeDispatcher,
type PinnedDispatcherPolicy,
@@ -93,6 +94,9 @@ async function fetchWithMatrixDispatcher(params: {
url: string;
init: MatrixDispatcherRequestInit;
}): Promise<Response> {
if (isMockedFetch(globalThis.fetch)) {
return await globalThis.fetch(params.url, params.init);
}
// Keep this dispatcher-routing logic local to Matrix transport. Shared SSRF
// fetches must stay fail-closed unless a retry path can preserve the
// validated pinned-address binding. Route dispatcher-attached requests

View File

@@ -3,5 +3,6 @@
export {
fetchWithRuntimeDispatcher,
isMockedFetch,
type DispatcherAwareRequestInit,
} from "../infra/net/runtime-fetch.js";