Skip to content

Instantly share code, notes, and snippets.

@DawnImpulse
Created May 29, 2018 07:53
Show Gist options
  • Save DawnImpulse/6084e56e3306a64e749e8468a2eb4f55 to your computer and use it in GitHub Desktop.
Save DawnImpulse/6084e56e3306a64e749e8468a2eb4f55 to your computer and use it in GitHub Desktop.
Needle (request) post method basic implementation (https://www.npmjs.com/package/needle)
var options = {
headers: {
'Content-Type': 'application/json'
}
};
needle('post',url, body,options)
.then((response) => {
if (response.statusCode !== 200) {
//do things
} else {
//do things
}
}).catch((error) => {
// do things
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment