var Promise this.Promise || require('promise');

var agent require('superagent-promise')(require('superagent'), Promise);
 
// method, url form with `end` 
agent('GET''http://google.com')
  .end()
  .then(function onResult(res{
    // do stuff 
  }function onError(err{
    //err.response has the response from the server 
  });
 
// method, url form with `then` 
agent('GET''http://google.com')
  .then(function onResult(res{
    // do stuff 
  });
 
 
// helper functions: options, head, get, post, put, patch, del 
agent.put('http://myxfoo''data')
  .end()
  .then(function(res{
    // do stuff` 
  });
 
// helper functions: options, head, get, post, put, patch, del 
agent.put('http://myxfoo''data').
  .then(function(res{
    // do stuff 
  });

相关文章:

  • 2021-05-02
  • 2022-12-23
  • 2021-05-16
  • 2021-07-10
  • 2021-08-27
  • 2021-05-31
  • 2021-08-06
猜你喜欢
  • 2021-07-11
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2022-12-23
相关资源
相似解决方案