How to use teeny-request - 2 common examples

To help you get started, we’ve selected a few teeny-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 googleapis / gcs-resumable-upload / src / index.ts View on Github external
authHeaders => {
          reqOpts.headers = Object.assign({}, reqOpts.headers, authHeaders);
          teenyRequest(reqOpts, (err, res, body) => {
            let e = (body && body.error) ? body.error : err;
            // If no error was returned, but the response had an invalid status
            // code, create a new error to be passed to the callback.
            if (!e && (res.statusCode < 200 || res.statusCode >= 300) &&
                res.statusCode !== RESUMABLE_INCOMPLETE_STATUS_CODE) {
              e = new Error(`The request failed with a ${res.statusCode}.`);
              e.code = res.statusCode;
            }
            callback(e, res, body);
          });
        },
        e => {
github googleapis / cloud-debug-nodejs / test / test-controller.ts View on Github external
request: (options: t.Options, cb: t.RequestCallback) => {
    teenyRequest(options, (err, r) => {
      cb(err, r ? r.body : undefined, r);
    });
  },
} as {}) as Debug;

teeny-request

Like request, but smaller.

Apache-2.0
Latest version published 1 year ago

Package Health Score

88 / 100
Full package analysis

Popular teeny-request functions