Skip to content

Commit e2c716e

Browse files
committed
use Response.redirect static method
1 parent 5f271e0 commit e2c716e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

worker/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@ export default class extends WorkerEntrypoint<Env> {
3333
);
3434

3535
if (redirect) {
36-
return new Response(null, {
37-
...redirect,
38-
headers: {
39-
...redirect.headers,
40-
"Location": redirect.url + "index.md"
41-
}
42-
});
36+
return Response.redirect(redirect.url + "index.md", redirect.status);
4337
}
4438

4539
return res;

0 commit comments

Comments
 (0)