File tree 2 files changed +4
-2
lines changed
packages/qwik-city/src/middleware/request-handler
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -229,8 +229,10 @@ export function createRequestEvent(
229
229
return new RedirectMessage ( ) ;
230
230
} ,
231
231
232
- rewrite : ( _url : string ) => {
232
+ rewrite : ( __url : string | URL ) => {
233
233
check ( ) ;
234
+
235
+ const _url = typeof __url === 'string' ? __url : __url . toString ( ) ;
234
236
const fixedURL = _url . replace ( / ( [ ^ : ] ) \/ { 2 , } / g, '$1/' ) ;
235
237
if ( _url !== fixedURL ) {
236
238
console . warn ( `Rewrite URL ${ _url } is invalid, fixing to ${ fixedURL } ` ) ;
Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ export interface RequestEventCommon<PLATFORM = QwikCityPlatform>
207
207
* URL to rewrite to. When called, the response will immediately end with the correct rewrite url.
208
208
* URL will remain unchanged in the browser history.
209
209
*/
210
- readonly rewrite : ( url : string ) => RewriteMessage ;
210
+ readonly rewrite : ( url : string | URL ) => RewriteMessage ;
211
211
212
212
/**
213
213
* When called, the response will immediately end with the given status code. This could be useful
You can’t perform that action at this time.
0 commit comments