diff --git a/README.md b/README.md index ffd2ad8..1368d12 100644 --- a/README.md +++ b/README.md @@ -183,28 +183,28 @@ axios.get( 非全平台兼容的属性只会在平台支持的情况下生效。 -| 参数 | 类型 | 默认值 | 说明 | 全平台兼容 | -| :---------------- | :------------------------ | :------------------------------------------------------------------------------------ | :----------------- | :--------- | -| adapter | Function | [查看](https://github.com/early-autumn/axios-miniprogram/blob/master/src/defaults.ts) | 自定义适配器 | 是 | -| baseURL | String | | 基础地址 | 是 | -| url | String | | 请求地址 | 是 | -| method | String | get | 请求方法 | | -| params | Object | | 请求参数 | 是 | -| data | String/Object/ArrayBuffer | | 请求数据 | 是 | -| headers | Object | [查看](https://github.com/early-autumn/axios-miniprogram/blob/master/src/defaults.ts) | 请求头 | 是 | -| validateStatus | Function | [查看](https://github.com/early-autumn/axios-miniprogram/blob/master/src/defaults.ts) | 自定义合法状态码 | 是 | -| paramsSerializer | Function | | 自定义参数序列化 | 是 | -| transformRequest | Function/Array<.Function> | | 自定义转换请求数据 | 是 | -| transformResponse | Function/Array<.Function> | | 自定义转换响应数据 | 是 | -| errorHandler | Function | | 自定义错误处理 | 是 | -| cancelToken | Object | | 取消令牌 | 是 | -| timeout | Number | 10000 | 超时时间 | | -| dataType | String | json | 响应数据格式 | 是 | -| responseType | String | text | 响应数据类型 | 是 | -| enableHttp2 | Boolean | false | 开启 http2 | | -| enableQuic | Boolean | false | 开启 quic | | -| enableCache | Boolean | false | 开启 cache | | -| sslVerify | Boolean | true | 验证 ssl 证书 | | +| 参数 | 类型 | 默认值 | 说明 | 全平台兼容 | +| :---------------- | :-----------------------: | :----------------------------------------------------------- | :----------------- | :--------- | +| adapter | Function | [查看](https://github.com/early-autumn/axios-miniprogram/blob/master/src/defaults.ts) | 自定义适配器 | 是 | +| baseURL | String | | 基础地址 | 是 | +| url | String | | 请求地址 | 是 | +| method | String | get | 请求方法 | | +| params | Object | | 请求参数 | 是 | +| data | String/Object/ArrayBuffer | | 请求数据 | 是 | +| headers | Object | [查看](https://github.com/early-autumn/axios-miniprogram/blob/master/src/defaults.ts) | 请求头 | 是 | +| validateStatus | Function | [查看](https://github.com/early-autumn/axios-miniprogram/blob/master/src/defaults.ts) | 自定义合法状态码 | 是 | +| paramsSerializer | Function | | 自定义参数序列化 | 是 | +| transformRequest | Function/Array<.Function> | | 自定义转换请求数据 | 是 | +| transformResponse | Function/Array<.Function> | | 自定义转换响应数据 | 是 | +| errorHandler | Function | | 自定义错误处理 | 是 | +| cancelToken | Object | | 取消令牌 | 是 | +| timeout | Number | 10000 | 超时时间 | | +| dataType | String | json | 响应数据格式 | 是 | +| responseType | String | text | 响应数据类型 | 是 | +| enableHttp2 | Boolean | false | 开启 http2 | | +| enableQuic | Boolean | false | 开启 quic | | +| enableCache | Boolean | false | 开启 cache | | +| sslVerify | Boolean | true | 验证 ssl 证书 | | #### `config.method`的合法值 @@ -575,3 +575,6 @@ axios("/user") // 请求失败 // axios => axios.interceptors.request => config.transformRequest => config.paramsSerializer => config.adapter => config.validateStatus => config.transformResponse => config.errorHandler => axios.interceptors.response => catch ``` + + + diff --git a/src/helpers/url.ts b/src/helpers/url.ts index f4b7974..d7bf80c 100644 --- a/src/helpers/url.ts +++ b/src/helpers/url.ts @@ -23,15 +23,15 @@ export function buildURL( return generateURL(url, paramsSerializer(params)); } -const combineREG = /(?