@@ -508,8 +508,18 @@ export class MSWPlugin implements Plugin {
508508 if ( url . searchParams . get ( 'visibility' ) ) queryRequest . visibility = url . searchParams . get ( 'visibility' ) ;
509509 if ( url . searchParams . get ( 'createdBy' ) ) queryRequest . createdBy = url . searchParams . get ( 'createdBy' ) ;
510510 if ( url . searchParams . get ( 'isDefault' ) ) queryRequest . isDefault = url . searchParams . get ( 'isDefault' ) === 'true' ;
511- if ( url . searchParams . get ( 'limit' ) ) queryRequest . limit = parseInt ( url . searchParams . get ( 'limit' ) ! ) ;
512- if ( url . searchParams . get ( 'offset' ) ) queryRequest . offset = parseInt ( url . searchParams . get ( 'offset' ) ! ) ;
511+
512+ // Parse numeric parameters with validation
513+ const limitParam = url . searchParams . get ( 'limit' ) ;
514+ const offsetParam = url . searchParams . get ( 'offset' ) ;
515+ if ( limitParam ) {
516+ const limit = parseInt ( limitParam , 10 ) ;
517+ if ( ! isNaN ( limit ) && limit > 0 ) queryRequest . limit = limit ;
518+ }
519+ if ( offsetParam ) {
520+ const offset = parseInt ( offsetParam , 10 ) ;
521+ if ( ! isNaN ( offset ) && offset >= 0 ) queryRequest . offset = offset ;
522+ }
513523
514524 const result = await protocol . listViews ( queryRequest ) ;
515525 return HttpResponse . json ( result ) ;
@@ -522,7 +532,11 @@ export class MSWPlugin implements Plugin {
522532 http . patch ( `${ baseUrl } /ui/views/:id` , async ( { params, request } ) => {
523533 try {
524534 const body = await request . json ( ) as any ;
525- const updateData = typeof body === 'object' && body !== null ? { ...body , id : params . id as string } : { id : params . id as string } ;
535+ // Merge body with id parameter, ensuring body is an object
536+ const updateData = ( typeof body === 'object' && body !== null )
537+ ? { ...body , id : params . id as string }
538+ : { id : params . id as string } ;
539+
526540 const result = await protocol . updateView ( updateData as any ) ;
527541 if ( result . success ) {
528542 return HttpResponse . json ( result ) ;
0 commit comments