Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/runtime/internal/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function fetch(
return serverFetch(resource, init, context);
}
resource = (resource as any)._request || resource; // unwrap srvx request
return fetch(resource, init);
return globalThis.fetch(resource, init);
}

function createNitroApp(): NitroApp {
Expand Down
3 changes: 3 additions & 0 deletions test/fixture/server/routes/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export default async () => {
).then((res) => res.json()),
"nitro/runtime.serverFetch": await runtimeServerFetch("/api/hello").then((res) => res.json()),
"nitro/runtime.fetch": await runtimeFetch("/api/hello").then((res) => res.json()),
"nitro/runtime.fetch.url": await runtimeFetch(new URL("http://localhost/api/hello")).then(
(res) => res.json()
),
"nitro/serverFetch": await nitroServerFetch("/api/hello").then((res) => res.json()),
"nitro/fetch": await nitroFetch("/api/hello").then((res) => res.json()),
};
Expand Down
Loading