How to use retry-request - 2 common examples

To help you get started, we’ve selected a few retry-request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bartozzz / crawlerr / src / routing / router.js View on Github external
return new Promise((resolve, reject) => {
      retryRequest(uri, { request: this.request }, (error, response) => {
        if (error || response.statusCode !== 200) {
          return reject(error || uri);
        }

        const req: Object = {};
        const res: Object = response;

        // Set circular references:
        res.req = req;
        req.res = res;

        // Alter the prototypes:
        setPrototypeOf(req, this.req);
        setPrototypeOf(res, this.res);

        resolve({ req, res, uri });
github Bartozzz / crawlerr / src / queue / index.js View on Github external
request( uri, resolve, reject ) {
        if ( !uri.startsWith( this.base ) )
            uri = url.resolve( this.base, uri );

        request( uri, ( error, response ) => {
            if ( error || response.statusCode != 200 ) {
                reject( error || uri );
            }

            const req = {};
            const res = response;

            // Set circular references:
            res.req = req;
            req.res = res;

            // Alter the prototypes:
            req.__proto__ = this.req;
            res.__proto__ = this.res;

            resolve( req, res );

retry-request

Retry a request.

MIT
Latest version published 11 months ago

Package Health Score

91 / 100
Full package analysis

Popular retry-request functions