鍍金池/ 問答/HTML5  HTML/ 兩個node 后端請求包(superagent和request)的get請求有什

兩個node 后端請求包(superagent和request)的get請求有什么不同嗎?

  superagent
  // 設(shè)置些需要的頭
  .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)
  })
  
  
  請求中華人才網(wǎng)的一個接口,用request.get 能正確返回想要的結(jié)果用superagent卻得到空。
回答
編輯回答
墨染殤

如果響應(yīng)的content-typetext,superagent會放在response.text里。

2017年11月24日 09:07