Skip to content

transform objects to http responses with configurable retry strategy

License

Notifications You must be signed in to change notification settings

elee/web-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-stream

Build Status

Transform objects to http responses with configurable retry strategy.

Construct the stream:

 new WebStream([{[maxBackoff,[shouldRetry]]}])

Where maxBackoff is the maximum amount of time to wait between retries (i.e. 3000 is 3 seconds), shouldRetry is a function with three arguments (err, res, body) and returns a boolean truth-y to retry false-y to continue.

Wire it to another stream for input that sends in:

 {
   url : 'http://some/url',
   method : 'GET'
 }

For HTTP methods that make sense you may also send in: 'body' and 'header' attributes in this object.

Which will be passed to request as it's options paramter.

web-stream is compatible with 0.8 node via the readable-stream module.

run the example:

 $ npm install
 $ cd example ; node .

Contributing

Run the tests:

grunt

About

transform objects to http responses with configurable retry strategy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published