*entries(): IterableIterator<[string, unknown]> { for (const record of this.records) {
yield [record.name, record.value];
}
}
get [Symbol.toStringTag](): string { return"FormData";
}
}
class MockAgent {
readonly __testStub = true;
}
class MockEnvHttpProxyAgent {
readonly __testStub = true;
}
class MockProxyAgent {
readonly __testStub = true;
}
afterEach(() => {
Reflect.deleteProperty(globalThis as object, TEST_UNDICI_RUNTIME_DEPS_KEY);
});
describe("fetchWithRuntimeDispatcher", () => {
it("normalizes global FormData bodies into the runtime FormData implementation", async () => { const runtimeFetch = vi.fn(async (_input: RequestInfo | URL, init?: RequestInit) => { // init.body was rebuilt as RuntimeFormData by normalizeRuntimeFormData; // BodyInit and RuntimeFormData live in separate type namespaces so a double cast is needed. const body = init?.body as unknown as RuntimeFormData;
expect(body).toBeInstanceOf(RuntimeFormData);
expect(body.records).toEqual(
expect.arrayContaining([
expect.objectContaining({
name: "model",
value: "gpt-4o-transcribe",
}),
expect.objectContaining({
name: "file",
filename: "clip.ogg",
}),
]),
); returnnew Response("ok", { status: 200 });
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.