resilient-http / resilient.js

Fault tolerant and reactive HTTP client for node.js and browsers
183 stars 13 forks source link

Support observer hooks #131

Open h2non opened 8 years ago

h2non commented 8 years ago

Replace events in favor of observer hooks with control flow capabilities.

const client = resilient({})

client.observe('before request', function (ctx, next) {
 // logic goes here...  
})

client.observe('dialing', function (ctx, next) {
 // logic goes here...  
})

client.observe('retry', function (ctx, next) {
 // logic goes here...  
})

client.observe('response', function (ctx, next) {
 // logic goes here...  
})