creq
v1.0.0
Published
customize request
Downloads
1
Readme
CReq
Customize Request. see more from Request
Installation
npm install creq
Usage
const request = require('creq');
Http
let value = await request.http({
method: 'GET',
url: 'http://www.baidu.com',
headers: {},
query: {
key: 'value'
},
body: {
data: 'msg'
},
error: (err) => {
console.log(err);
}
});
Get
let value = await request.get({
url: 'http://www.baidu.com',
query: {
key: 'value'
}
});
Post
let value = await request.post({
url: 'http://www.baidu.com',
body: {
data: 'msg'
}
});
Put
let value = await request.put({
url: 'http://www.baidu.com',
body: {
data: 'msg'
}
});
DEL
let value = await request.del({
url: 'http://www.baidu.com',
body: {
data: 'msg'
}
});