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 {
26
26
body ?: string
27
27
) {
28
28
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 ;
30
33
( params ?? [ ] ) . forEach ( ( [ key , value ] ) => {
31
34
if ( key ) {
32
- paramsData [ key ] = value ;
35
+ paramsData [ key + '__' + i ] = value ;
36
+ i ++ ;
33
37
}
34
38
} ) ;
35
39
@@ -140,7 +144,7 @@ export default class Api {
140
144
req . url +
141
145
( req . url . search ( / \? / ) >= 0 ? '&' : '?' ) +
142
146
Object . entries ( params )
143
- . map ( ( [ k , v ] ) => `${ encodeURIComponent ( k ) } =${ encodeURIComponent ( v ) } ` )
147
+ . map ( ( [ k , v ] ) => `${ encodeURIComponent ( k . replace ( / _ _ \d + $ / , '' ) ) } =${ encodeURIComponent ( v ) } ` )
144
148
. join ( '&' ) ;
145
149
}
146
150
You can’t perform that action at this time.
0 commit comments