【问题标题】:superagent dynamic method types超级代理动态方法类型
【发布时间】:2018-04-03 22:19:18
【问题描述】:

我正在使用superagent,但我遇到了动态方法名称的问题。 对于我应该写的每一种方法:

request
  .get(url)

request
  .post(url)

有没有办法像在 axios 中那样将方法名称作为参数传递给超级代理

 axios({
  method: 'post',
  url,
  data
});

【问题讨论】:

    标签: javascript reactjs redux superagent


    【解决方案1】:

    您也可以使用如下检查docs

    request('GET', url).end(callback);// and pass your first param as http verb 'GET','POST', etc...
    

    只是

    request.get(url);
    

    或者

    request.post(url);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-03
      • 2018-07-14
      • 1970-01-01
      • 2020-04-03
      • 2019-08-11
      • 2019-04-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多