1.1.1 • Published 7 years ago
httpaction v1.1.1
npm install httpaction
required
Should have a config name folder at /
configuration should be JSON format only.
send request
const {httpRequest} = ("httpaction");
params
method :- should be (get post) or you can add in your config or default get
headers :-send headers whatever you want
defaultHeaders = {
"Content-Type": "application/json; charset=utf-8",
"mode" : 'no-cors'
};
payload :- send data as payload
example ("CLEVERTAP") :- means should pass config key which you want to use in this call
Url:- url should be in your config key.
params.auth == true :- we can set unique as uuid in cookies
#version 1.0.10
httpRequest("CLEVERTAP",params = {},function(err,res,body){
if(err) console.log(err)
console.log(JSON.stringify(body))
});
#version 1.1.0
- Promise based response
- params will be converted as querystring in get request
httpRequest("CLEVERTAP",params = {}).then((res)=>{
console.log(">>>>>>> ",res);
},(error)=>{
console.log(">>>>>>> err ",error);
}).catch((error)=>{
console.log(">>>>>>> err ",error);
});
#version 1.1.1
- configuration name validation
config folder
Please check config folder for same
config file name in config folder should follow as config.{env}.json
author
Nitin tyagi
Please contact @ nitin.1992tyagi@gmail.com