tuax / tua-api

🏗 一款可配置的通用 api 请求函数生成工具(A common tool helps converting configs to api functions)

Home Page:https://tuax.github.io/tua-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: 使用 axios 发送 get 请求时参数有问题

BuptStEve opened this issue · comments

版本
Version 1.2.0

描述一下 bug
简洁清晰地描述一下 bug。如果方便的话,添加一些截图描述你的问题。

使用 axios 发送 get 请求时,若在 apiConfig 中填写的 params 为对象形式,由于会被透传给 axios 所以最后参数会有冗余字段。

复现 bug
复现的步骤:

  1. 首先 apiConfig 中
export default {
  type: 'get',
  reqType: 'axios',
  pathList: [
    {
      path: 'foo',
      params: { a: { required: true } },
    },
  ],
}
  1. 调用接口
exampleApi.foo({ a: '123' })
  1. 调用的接口参数是 ?a=123&a=%7Brequired%3Atrue%7D

预期行为
没有多余参数