How to use the xhr.patch function in xhr

To help you get started, we’ve selected a few xhr 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 node-gitlab / node-gitlab / src / infrastructure / XMLHttpRequester.ts View on Github external
await wait(sleepTime * 1000);
    } else if (response.statusCode >= 400 && response.statusCode <= 599) {
      throw new StatusCodeError(response.statusCode, response.body, {}, null);
    }

    return opts.resolveWithFullResponse ? response : response.body;
  } as XhrInstancePromisified;
}

const promisifyWithRetryDelete = promisifyWithRetry(XHR.del);
const XMLHttpRequesterPromisifiedExtras = {
  del: promisifyWithRetryDelete,
  delete: promisifyWithRetryDelete,
  get: promisifyWithRetry(XHR.get),
  head: promisifyWithRetry(XHR.head),
  patch: promisifyWithRetry(XHR.patch),
  post: promisifyWithRetry(XHR.post),
  put: promisifyWithRetry(XHR.put),
};

const XMLHttpRequester: XhrStaticPromisified = Object.assign(
  promisifyWithRetry(XHR),
  XMLHttpRequesterPromisifiedExtras,
);

export default XMLHttpRequester;