Server fetch ignore init if first param is a Request
Author: burleightCreated Jan 22, 2026Updated Sep 13, 2026
Labelsfetch-headers
Describe the bug
normalize_fetch_input ignores init if info is a Request:
/**
* @param {RequestInfo | URL} info
* @param {RequestInit | undefined} init
* @param {URL} url
*/
function normalize_fetch_input(info, init, url) {
if (info instanceof Request) {
return info;
}
return new Request(typeof info === 'string' ? new URL(info, url) : info, init);
}https://github.com/sveltejs/kit/blob/main/packages/kit/src/runtime/server/fetch.js#L188
When init is ignored, the server fetch function doesn't behave like it does in the browser.
Reproduction
For example:
export const load: PageServerLoad = async ({ fetch }) => {
const req = new Request(someUrl);
const init = { headers: { 'Authorization': 'some-token } };
// this ignores init
const response = await fetch(req, init);
// this uses init with the headers
const response2 = await fetch(new Request(req, init));
}In the browser each fetch call would behave the same. mdn has a similar example - https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#passing_options_into_both_request_and_fetch
Logs
System Info
npmPackages:
@sveltejs/adapter-auto: ^6.1.0 => 6.1.1
@sveltejs/adapter-node: ^5.4.0 => 5.4.0
@sveltejs/kit: ^2.43.2 => 2.50.0
@sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
svelte: ^5.39.5 => 5.39.10
vite: 7.1.11 => 7.1.11Severity
annoyance
Additional Information
No response
Source: sveltejs/kit