@@ -3,7 +3,7 @@ import { isArray, isFile } from '../util/objects'
3
3
import type { Errors } from '..'
4
4
import Validator from './Validator'
5
5
import { objectToFormData } from '../util/formData'
6
- import qs from 'qs'
6
+ import qs , { ParsedQs } from 'qs'
7
7
8
8
const validator = Validator
9
9
const UNPROCESSABLE_ENTITY = 422
@@ -105,16 +105,6 @@ class BaseProxy {
105
105
return query ? `${ url } ?${ query } ` : url
106
106
}
107
107
108
- __getQueryString ( parameter : string ) : any | any [ ] {
109
- const queries : string [ ] = parameter . split ( '&' )
110
- const obj : any = { }
111
- queries . forEach ( function ( property : string ) {
112
- const [ key = null , value = null ] : string [ ] = property . split ( '=' )
113
- obj [ key ] = value
114
- } )
115
- return obj
116
- }
117
-
118
108
__validateRequestType ( requestType : Method ) : void {
119
109
const requestTypes : Array < string > = [
120
110
'get' ,
@@ -182,11 +172,13 @@ class BaseProxy {
182
172
183
173
setParameter ( parameter : string , value ?: any ) : this {
184
174
if ( ! value ) {
185
- const params = this . __getQueryString ( parameter )
186
- Object . entries ( params ) . forEach (
187
- ( [ key , value ] ) => ( this . parameters [ key ] = value ) ,
188
- )
189
- return this
175
+ const options = {
176
+ comma : true ,
177
+ allowDots : true ,
178
+ ignoreQueryPrefix : true ,
179
+ }
180
+ const params : ParsedQs = qs . parse ( parameter , options )
181
+ return this . setParameters ( params )
190
182
}
191
183
this . parameters [ parameter ] = value
192
184
return this
0 commit comments