nuǝɯ pǝɥsᴉꞁod mǝu
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    needle-retrypublic

    needle-retry

    npm version Build Status Dependency Status devDependency Status

    Combines needle with retry to account for unstable webservers. Thus, needle-retry will retry for a certain number of times (default 5) before giving up. Currently implements request and get. Tests currently only cover GET requests but everything should work too, as this is basically just a wrapper.

    Installation

    npm install needle-retry
    

    Options

    Options can be passed in as the second parameter, as an object with a property needle for needle options and a property retry for retry options. This module has a single option, fullDocument that will make it retry if a full HTML document is not received. Defaults to false. Default options:

    var options = {
        needleRetry: {
            fullDocument: false
        },
        needle: {
            follow_max: 20
        },
        retry: {
            retries: 5
        }
    }

    Have a look at the respective doc pages for needle and retry for a list of available options.

    Example

    var needle = require('needle-retry');
     
    needle.get('http://www.github.com', function(error, response) {
      console.log(response.body);
    });

    Example request

    var needle = require('needle-retry');
     
    var options = {
        needleRetry: {
            fullDocument: false
        },
        needle: {
            follow_max: 20
        },
        retry: {
            retries: 5
        }
    }
     
    var data = {
        foo: 'bar'
    }
     
    needle.request('get', 'http://www.github.com', data, options, function(error, response) {
      console.log(response.body);
    });

    Keywords

    install

    npm i needle-retry

    Downloadsweekly downloads

    33

    version

    1.1.2

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar