Skip to content

Commit 3a7536e

Browse files
fix: use encodeURI only, drop URL.canParse per review
Per maintainer review: - URL.canParse may not be available in all runtimes - encodeURI handles both absolute and relative URLs correctly - No need for conditional logic — encodeURI is sufficient Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 21366c1 commit 3a7536e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function redirect(
4444
status: number = 302,
4545
statusText?: string,
4646
): HTTPResponse {
47-
const encodedLoc = URL.canParse(location) ? new URL(location).href : encodeURI(location);
47+
const encodedLoc = encodeURI(location);
4848
const body = /* html */ `<html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}" /></head></html>`;
4949
return new HTTPResponse(body, {
5050
status,

0 commit comments

Comments
 (0)