finds.dev← search

// the find

mikeal/bent

★ 2,189 · JavaScript · updated Dec 2022

Functional JS HTTP client (Node.js & Fetch) w/ async await

bent is a minimal HTTP client for Node.js and browsers built around partial application — you configure a client once with method, base URL, accepted status codes, and response format, then call it repeatedly. The mental model is functional rather than object-oriented, which makes it easy to define named clients like `getJSON` or `postForm` up front. It's aimed at developers who find axios or node-fetch's default API too verbose for straightforward request patterns.

The partial application pattern is genuinely useful: declaring `const getJSON = bent('https://api.example.com', 'json', 200)` once and reusing it is cleaner than constructing request objects repeatedly. Bundle size is tiny — 1k gzipped with no external dependencies, which matters when you're shipping to browsers. Status code enforcement as a first-class constraint (non-200 throws by default) means you can't silently swallow HTTP errors the way raw fetch lets you. The API surface is small enough to read entirely in five minutes.

Abandoned since December 2022 — no commits, no maintenance. Node.js now ships `fetch` natively, which removes most of bent's browser parity argument, and the ecosystem has largely moved to that or undici. The positional option API (figuring out which arg is the method vs. the base URL by inspecting content) feels clever at first but makes TypeScript and autocomplete unhelpful — there are no typed overloads. Retry logic, timeouts, and interceptors are completely absent with no extension point, so any real production use ends up wrapping it anyway. At that point you might as well write the wrapper around native fetch.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →