{"repo":"paulmillr/micro-ftch","free":true,"listed":false,"github":"https://github.com/paulmillr/micro-ftch","clone":"git clone https://github.com/paulmillr/micro-ftch.git","description":"Wrappers for built-in fetch() enabling killswitch, logging, concurrency limit and other features.","language":"TypeScript","stars":63,"topics":["cache","concurrency","fetch","ftch","jsonrpc","killswitch","logging","mock","parallel","replay"],"license":"MIT","category":"analytics","readme_excerpt":"micro-ftch Wrappers for built-in fetch() enabling killswitch, logging, concurrency limit and other features. fetch is great, however, its usage in secure environments is complicated. The library makes it simple. Usage A standalone file micro-ftch.js is also available. npm install micro-ftch jsr add jsr:@paulmillr/micro-ftch - ftch - isValidRequest - allowedHosts - log - timeout - concurrencyLimit - rps - maxBodySize - Basic auth - jsonrpc - replayable - retry - Privacy - License There are four wrappers over fetch() : 1. ftch(fetch) - isValidRequest, allowed hosts, logging, timeouts, concurrency & rate limits, body size limits, basic auth 2. jsonrpc(fetch) - batched JSON-RPC functionality 3. replayable(fetch) - log & replay network requests without actually calling network code. 4. retry(fetch) - retries failed requests with exponential backoff and jitter. ftch Basic wrapper over fetch() . isValidRequest When isValidRequest killswitch is enabled, all requests will throw an error. You can dynamically enable and disable it at any time. The callback may return a boolean or a Promise ; it is checked before a request, after response headers, and after the response body has been buffered. For immediate cancellation of active requests, use the one-shot signal killswitch. It also blocks queued and future requests made through that wrapper; construct a new wrapper to re-enable network access. allowedHosts Declarative origin allowlist, kept under the allowedHosts option name for compati","default_branch":null,"files":null,"tree":[],"storefront":"/r/paulmillr","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/paulmillr/micro-ftch/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}