request-lib
v1.0.0
Published
The small library for making HTTP / HTTPS request into the endpoint
Downloads
3
Maintainers
Readme
Request Lib
The small library for making HTTP / HTTPS request into the endpoint.
Usage
- To make quick GET request.
const RequestLib = require('request-lib');
RequestLib.get({
url: 'http://localhost',
params: {
'params1': "Value1",
'params2': "Value2"
},
headers: {}
})
.then((Response) => {
console.log("Response ...");
console.log(Response.response_text);
}).catch((Error) => {
console.log("Error ...");
console.log(Error);
});
- To make POST request.
const RequestLib = require('request-lib');
RequestLib.post({
url: 'http://localhost',
params: {
'params1': "Value1",
'params2': "Value2"
},
body: {
'body1': "Value1",
'body2': "Value2"
},
headers: {}
})
.then((Response) => {
console.log("Response ...");
console.log(Response.response_text);
}).catch((Error) => {
console.log("Error ...");
console.log(Error);
});
- To make PUT request.
const RequestLib = require('request-lib');
RequestLib.put({
url: 'http://localhost',
params: {
'params1': "Value1",
'params2': "Value2"
},
body: {
'body1': "Value1",
'body2': "Value2"
},
headers: {}
})
.then((Response) => {
console.log("Response ...");
console.log(Response.response_text);
}).catch((Error) => {
console.log("Error ...");
console.log(Error);
});
- To make DELETE request.
const RequestLib = require('request-lib');
RequestLib.delete({
url: 'http://localhost',
params: {
'params1': "Value1",
'params2': "Value2"
},
headers: {}
})
.then((Response) => {
console.log("Response ...");
console.log(Response.response_text);
}).catch((Error) => {
console.log("Error ...");
console.log(Error);
});
Keep in touch
License
MIT License