ttrequest

1.0.2 • Public • Published

ttrequest


http request中间件

Install

$ npm install ttrequest

使用说明

var ttRequest = require('ttrequest');
 
//返回body,不对body做处理
ttRequest.exec(callInfo, params, function (err, body) {
 
})
 
//返回结果,获取body里的result属性,返回body.result
ttRequest(callInfo, params, function (err, result) {
 
})

call

{
    method: 'post',                                 //post或get        必填
    host: 'http://api.baidu.com/',                  //服务host         必填
    headers:{"Content-Type":"application/json"},    //请求服务的header 可选
    path: '/api/test'                               //path,服务的path  必填
}

params

GET或者POST 都使用Object类型,中间件会自动展开

Readme

Keywords

Package Sidebar

Install

npm i ttrequest

Weekly Downloads

2

Version

1.0.2

License

ISC

Last publish

Collaborators

  • tonyleen