Created
May 29, 2018 07:53
-
-
Save DawnImpulse/6084e56e3306a64e749e8468a2eb4f55 to your computer and use it in GitHub Desktop.
Needle (request) post method basic implementation (https://www.npmjs.com/package/needle)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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