File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class BaseResponse extends Body implements Response {
45
45
)
46
46
}
47
47
48
- return new Response ( url , {
48
+ return new Response ( String ( new URL ( url ) ) , {
49
49
headers : { Location : url } ,
50
50
status,
51
51
} )
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ export class NextResponse extends Response {
79
79
'Failed to execute "redirect" on "response": Invalid status code'
80
80
)
81
81
}
82
- const destination = typeof url === 'string' ? url : url . toString ( )
82
+
83
+ const destination = String ( new URL ( String ( url ) ) )
83
84
return new NextResponse ( destination , {
84
85
headers : { Location : destination } ,
85
86
status,
@@ -89,10 +90,7 @@ export class NextResponse extends Response {
89
90
static rewrite ( destination : string | NextURL ) {
90
91
return new NextResponse ( null , {
91
92
headers : {
92
- 'x-middleware-rewrite' :
93
- typeof destination === 'string'
94
- ? destination
95
- : destination . toString ( ) ,
93
+ 'x-middleware-rewrite' : String ( new URL ( String ( destination ) ) ) ,
96
94
} ,
97
95
} )
98
96
}
You can’t perform that action at this time.
0 commit comments