File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,14 @@ export default class Api {
2626 body ?: string
2727 ) {
2828 const paramsData : Record < string , string > = { } ;
29-
29+ // In order to allow for duplicate URL params add a suffix to it to
30+ // uniquify the key. We strip this suffix off as part of
31+ // constructing the final URL in _request()
32+ let i = 0 ;
3033 ( params ?? [ ] ) . forEach ( ( [ key , value ] ) => {
3134 if ( key ) {
32- paramsData [ key ] = value ;
35+ paramsData [ key + '__' + i ] = value ;
36+ i ++ ;
3337 }
3438 } ) ;
3539
@@ -140,7 +144,7 @@ export default class Api {
140144 req . url +
141145 ( req . url . search ( / \? / ) >= 0 ? '&' : '?' ) +
142146 Object . entries ( params )
143- . map ( ( [ k , v ] ) => `${ encodeURIComponent ( k ) } =${ encodeURIComponent ( v ) } ` )
147+ . map ( ( [ k , v ] ) => `${ encodeURIComponent ( k . replace ( / _ _ \d + $ / , '' ) ) } =${ encodeURIComponent ( v ) } ` )
144148 . join ( '&' ) ;
145149 }
146150
You can’t perform that action at this time.
0 commit comments