perf:增加对post put 请求参数处理
This commit is contained in:
parent
0807d9c02a
commit
e07daa0ab7
@ -32,6 +32,18 @@ service.interceptors.request.use(
|
|||||||
) {
|
) {
|
||||||
config.data = qs.stringify(config.data)
|
config.data = qs.stringify(config.data)
|
||||||
}
|
}
|
||||||
|
// post put 参数处理
|
||||||
|
if (
|
||||||
|
(config.method === 'post' || config.method === 'put') &&
|
||||||
|
(config.headers as any)['Content-Type'] === 'application/json'
|
||||||
|
) {
|
||||||
|
for (const key in config.data) {
|
||||||
|
// 参数处理
|
||||||
|
if (config.data[key] === '') {
|
||||||
|
config.data[key] = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// get参数编码
|
// get参数编码
|
||||||
if (config.method === 'get' && config.params) {
|
if (config.method === 'get' && config.params) {
|
||||||
let url = config.url as string
|
let url = config.url as string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user