Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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类型,中间件会自动展开

About

simple request

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages