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 
  });

最新文章

  1. xcode低版本调试高版本真机系统
  2. php常见知识
  3. CentOS 7 php留言本网站的搭建
  4. Redis源码研究--redis.h
  5. C#App.config的使用
  6. bonjour
  7. Android_开发人员经常使用的颜色
  8. oc是一个全动态语言,oc的一切都是基于runtime实现的!
  9. TypeScript 中非代码模块的导入
  10. golang web实战之二(iris)
  11. 随心测试_软测基础_007<软测学习路线建议>
  12. LOJ #2721. 「NOI2018」屠龙勇士(set + exgcd)
  13. ms sql server,oracle数据库实现拼接一列的多行内容
  14. 一、TCP扫描技术
  15. 卡尔曼滤波器实例:跟踪自由落体运动:设计与Matlab实现
  16. JS如何遍历Object中的所有属性?
  17. 聊聊Java的final关键字
  18. 取消SVN版本号控制的bash脚本
  19. Spring 事物传播特性
  20. 切换usb口的命令

热门文章

  1. C# Redis存Session Hash存对象
  2. opencv中的仿射变换
  3. React基础(Diff算法,属性和状态)
  4. 我给女朋友讲编程CSS系列(1) –添加CSS样式的3种方式及样式表的优先权
  5. Composer 下载安装类库
  6. SQL Server2012使用导入和导出向导时,用sql语句作为数据源,出现数据源类型会变成202或者203
  7. jquery对象与js对象
  8. 关于JavaWeb开发的一些感悟
  9. POJ 3321:Apple Tree(dfs序+树状数组)
  10. Java Socket实战之三 传输对象