fetchface
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "fetchface", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A convenient interface for the Fetch API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -60,3 +60,12 @@ # Fetchface | ||
// Add a callback hook to be fired upon specific response codes | ||
// Set a request header for a single request | ||
fetchf.post('/users', { | ||
body: { name: 'Dave' }, | ||
headers: { 'x-my-custom-header': 'awesome' }, | ||
}) | ||
.then(newUserData => { | ||
console.log(newUserData); | ||
}); | ||
// Add a callback hook to be fired upon receiving specific response codes | ||
fetchf.onResponseCode(401, () => { | ||
@@ -77,2 +86,2 @@ console.log('Unauthorized!'); | ||
## License | ||
[MIT License](https://github.com/justinsisley/fetchface/blob/master/LICENSE.md) © [Justin Sisley](http://justinsisley.com/) | ||
[MIT License](https://github.com/justinsisley/fetchface/blob/master/LICENSE.md) © [Justin Sisley](http://justinsisley.com/) |
7458
86