两个node 后端请求包(superagent和request)的get请求有什么不同吗?

  superagent
  // 设置些需要的头
  .get('http://passport.chinahr.com/ajax/m/existLoginName')
  .query('input' + "=" + 15800000000)
  .end(function (err, response) {
    console.log('返回', response.body, err)
  });

  request
  .get('http://passport.chinahr.com/ajax/m/existLoginName?input=15800000000', function (err, res) {
    console.log('req', res.body)
  })
  
  
  请求中华人才网的一个接口,用request.get 能正确返回想要的结果用superagent却得到空。
阅读 2.2k
1 个回答

如果响应的content-typetextsuperagent会放在response.text里。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题