File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,15 @@ describe('Request', () => {
102102 request . params = null ;
103103 expect ( request . fullQueryPath ( ) ) . toBe ( '/foo/bar?' ) ;
104104 } ) ;
105+
106+ it ( 'should serialize array params as comma-separated values' , ( ) => {
107+ request . verb = 'GET' ;
108+ request . params = {
109+ amenities : [ 'bar' , 'baz' ] ,
110+ ratings : [ 4 , 5 ] ,
111+ } ;
112+ expect ( request . fullQueryPath ( ) ) . toBe ( '/foo/bar?amenities=bar%2Cbaz&ratings=4%2C5' ) ;
113+ } ) ;
105114 } ) ;
106115
107116 describe ( '.body' , ( ) => {
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ class Request {
115115 */
116116 fullQueryPath ( ) {
117117 if ( this . verb === 'POST' ) { return this . path ; }
118- else { return `${ this . path } ?${ qs . stringify ( this . params ) } ` ; }
118+ else { return `${ this . path } ?${ qs . stringify ( this . params , { arrayFormat : 'comma' } ) } ` ; }
119119 }
120120
121121 /**
You can’t perform that action at this time.
0 commit comments