@@ -3,7 +3,7 @@ import { isArray, isFile } from '../util/objects'
33import type { Errors } from '..'
44import Validator from './Validator'
55import { objectToFormData } from '../util/formData'
6- import qs from 'qs'
6+ import qs , { ParsedQs } from 'qs'
77
88const validator = Validator
99const UNPROCESSABLE_ENTITY = 422
@@ -105,16 +105,6 @@ class BaseProxy {
105105 return query ? `${ url } ?${ query } ` : url
106106 }
107107
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-
118108 __validateRequestType ( requestType : Method ) : void {
119109 const requestTypes : Array < string > = [
120110 'get' ,
@@ -182,11 +172,13 @@ class BaseProxy {
182172
183173 setParameter ( parameter : string , value ?: any ) : this {
184174 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 )
190182 }
191183 this . parameters [ parameter ] = value
192184 return this
0 commit comments