Skip to content

Commit e3a7dcd

Browse files
authored
Make headers accessible in the reroute hook
1 parent 776ef06 commit e3a7dcd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/kit/src/runtime/server/respond.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ export async function respond(request, options, manifest, state) {
114114
let resolved_path;
115115

116116
try {
117-
// reroute could alter the given URL, so we pass a copy
118-
resolved_path = options.hooks.reroute({ url: new URL(url) }) ?? url.pathname;
117+
// reroute could alter the given data, so we pass copies
118+
resolved_path = options.hooks.reroute({
119+
url: new URL(url),
120+
headers: new Headers(request.headers),
121+
}) ?? url.pathname;
119122
} catch {
120123
return text('Internal Server Error', {
121124
status: 500

0 commit comments

Comments
 (0)