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