Haskell HTTP Clients in 2026: http-client vs wreq vs req
Your service makes forty outbound calls per request. In development everything is instant. In production, one upstream starts returning 503s during peak traffic, connections pile up, and http-client’s connection manager — which you never configured — becomes the bottleneck. Then you add retries in three different modules, each with different semantics, and now a single failing dependency multiplies your request volume by four while your dashboards show a healthy service.
Haskell has three serious HTTP clients, and they sit at different levels of abstraction: http-client is the engine, wreq is a lens-flavoured convenience layer on top of it, and req is a rethought, type-safe client that deliberately avoids the engine’s rough edges. Choosing between them is not about which one “can” make a request — all three can. It is about which failure modes you want to own.
TL;DR — Quick Verdict
Use req for new application code — it has the cleanest correctness story (type-safe URLs, MonadHttp integration, automatic retries on timeouts), is on version 3.13.4, and was pushed as recently as December 2026. Use http-client when you are building a library or need low-level control — 0.7.19, MIT licensed, the engine everything else is built on, with explicit Manager handling. Use wreq when your team already thinks in lenses — 0.5.4.5, BSD-3, a genuinely ergonomic API for JSON, multipart uploads and AWS request signing, at the cost of a lens dependency throughout your code.
Short version: req for services, http-client for libraries, wreq for lens-native codebases.
Side-by-Side Comparison
| Dimension | http-client | wreq | req |
|---|---|---|---|
| Layer | Low-level engine | Convenience layer over http-client | Independent client |
| GitHub stars | 298 | 383 | 353 |
| Last push | 2026-06-10 | 2026-03-15 | 2026-12-02 |
| Latest version | 0.7.19 | 0.5.4.5 | 3.13.4 |
| License | MIT | BSD-3-Clause | BSD-3-Clause |
| TLS included | No — needs http-client-tls / -openssl | Yes (via TLS backend) | Yes, built in |
| URL safety | String / Request | String | Type-safe combinators (https, /:) |
| API style | Records plus setters | Lenses (&, .~, ^.) | Monadic DSL in MonadHttp |
| Retry on timeout | Manual | Manual | Automatic |
| JSON | Via http-conduit (httpJSON) | asJSON, asValue | jsonResponse, ReqBodyJson |
| Connection manager | Explicit, shareable | Shared internally | Single implicit global |
| Tested with | Broad GHC range | GHC 8.x–9.x | GHC 9.10.3, 9.12.4, 9.14.1 |
| Learning curve | Medium | High (lens) | Low |
The star counts are close because these are libraries, not products — people star the one they use once and never revisit. The version and push dates are the more useful signal: req is the only one of the three receiving commits this month.
Decision Matrix: Use Case → Tool
| Your situation | Use | Why |
|---|---|---|
| New web service calling third-party APIs | req | Type-safe URLs plus built-in retry behaviour |
| Writing a reusable HTTP library | http-client | Stable engine API, minimal dependencies |
| Heavy JSON response handling | wreq or req | wreq for lens traversal, req for typed decoding |
| Multipart file uploads | wreq | Documented multipart support with lens composition |
| AWS SigV4 signed requests | wreq | Built-in AWS request signing |
| Strict dependency budget | http-client | No lens, no extra layers |
| Existing codebase already uses lenses | wreq | Zero friction, idioms match |
| Streaming a large response body | http-client | withResponse gives you incremental body access |
| Test suites with mocked transport | req (MonadHttp) or http-client (requestAction) | Both expose seams; pick by style |
http-client — The Engine Everything Sits On
http-client is deliberately minimal. Its own documentation opens by saying it is a low-level API with no support for TLS — HTTPS requires http-client-tls or http-client-openssl. That is not a deficiency; it is a layering decision that keeps the engine free of crypto dependencies.
| |
Note the module: Network.HTTP.Simple lives in http-conduit, not in http-client itself. That is the single most common confusion for newcomers — they add http-client to build-depends, try to import a httpLBS, and get a missing-module error. The practical split is:
http-client—Request,Response,Manager,httpLbs(strict),withResponse.http-client-tls— the TLS backend that makeshttps://URLs work.http-conduit— the friendlyNetwork.HTTP.Simplewrapper withhttpLBS,httpJSON,httpNoBody.
JSON decoding is a one-liner through the wrapper:
| |
The docs are explicit about the exception behaviour: httpJSON throws a runtime exception on parse failure, and httpJSONEither returns an Either instead. In a long-running service, prefer the Either variant — a malformed upstream payload should be a handled case, not a crashed thread.
The engine’s real advantage is control over the connection manager. Manager is created once and shared; per-request Request values carry timeouts and settings:
| |
Sharing one Manager is not optional advice — creating a manager per request leaks connections and defeats keep-alive. If you see the process holding hundreds of sockets after a traffic spike, the cause is almost always a newTlsManager call inside a request handler.
One 2026-relevant change: version 0.7.19 made the transport mockable through Network.HTTP.Client.Internal.requestAction, which means test suites can now intercept requests at the engine level without a local server. That is a meaningful improvement for teams that were previously spinning up httpbin containers in CI.
wreq — Lenses All the Way Down
wreq wraps http-client and exposes the request as a lens target. Its README lists the features that justify the approach: a lens-based API, session handling with connection pooling and cookie persistence, automatic decompression, multipart forms, JSON with schema-less navigation, basic and OAuth2 bearer auth, and AWS Signature Version 4.
| |
The lens composition is the whole value proposition. Adding a query parameter, a header, or a cookie is one operator away, and the same operators compose a set of options that can be reused across calls:
| |
Typed JSON decoding is handled by asJSON, which is parameterised over MonadThrow — so it throws by default and can be evaluated as Either where you want explicit handling. The project’s own JsonResponse.hs example demonstrates the trick of selecting the target type from usage:
| |
The cost is the lens dependency, which is large, has a reputation for compile-time cost, and tends to colonise a codebase once introduced — every module starts importing Control.Lens and the operator soup grows. That is fine if your project already made that choice. It is a heavy tax if you are adding an HTTP call to an otherwise lens-free service.
wreq is also the strongest choice for two specific jobs: multipart uploads with file handles, and AWS SigV4 signing, both of which are documented features rather than DIY work. If you are talking to S3-compatible storage from Haskell, that alone can decide it.
req — A Client Designed Around Correctness
req starts from a different premise: HTTP calls in application code should be hard to get wrong. Its URL builder makes malformed URLs a type error rather than a runtime exception, and its MonadHttp constraint lets a request run in whatever monad stack your application already uses.
| |
Every element of that call is doing work:
https "httpbin.org" /: "post"builds the URL from components. There is no string concatenation, so a missing slash or an unencoded segment cannot silently produce a 404 that looks like an auth failure.ReqBodyJson payloadsets the content type and encodes the body in one step.jsonResponseis a response reader; swapping it forignoreResponsemakes the body handling explicit rather than accidental.memptyis the options record — query parameters, headers, port. It is a monoid, so options compose.
The README is candid about a deliberate limitation: req always uses one implicit global manager for simplicity and maximal connection sharing, and you cannot modify ManagerSettings of the default manager — using your own manager with different settings is possible but requires more typing. For application code that is the right default; for a library that needs to embed its own manager configuration, it is a reason to pick http-client instead.
Two behaviours worth knowing before adopting it:
- Automatic retrying.
reqretries on timeouts and certain connection failures by default. That is usually what you want, and it is also why you should not wrapreqcalls in your own retry loop — you will multiply attempts without noticing. Set retry counts in the config instead. MonadHttpis the test seam. Any monad with aMonadHttpinstance can run requests, so tests can substitute a stub instance instead of hitting the network. It is a lighter-weight approach than managing a mock transport, though it requires your functions to be polymorphic in the monad rather than pinned toIO.
req’s version 3.13.4 is tested against GHC 9.10.3, 9.12.4 and 9.14.1, which is the most current compatibility statement of the three projects — relevant if you track recent compiler releases.
Pitfalls That Actually Bite
Forgetting the TLS backend. http-client alone cannot do HTTPS. Symptoms range from an immediate “unsupported scheme” error to a connection that never completes. Add http-client-tls and use newTlsManager, not newManager.
Creating a manager per request. This is the number-one production incident with http-client. A manager owns the connection pool; instantiate per request and you get a new pool every time, no keep-alive, and file descriptors climbing until the process hits its limit. Create it once at startup and thread it through.
Assuming httpLBS streams. The result is a lazy ByteString, but the documentation states plainly that the body is read fully into memory when the request is made — laziness only improves memory behaviour afterwards. For a 2 GB download you need withResponse, which gives incremental access and guarantees the connection is released.
Mixing retry layers. If you use req (automatic retries) and also wrap calls in retrying or a custom backoff loop, a single transient failure becomes N×M attempts. Pick one layer, and if it is the outer one, disable inner retries.
Treating JSON decode failure as impossible. Upstreams add fields, rename keys, and occasionally return an HTML error page with a 200 status. Use httpJSONEither (http-client) or evaluate asJSON as Either (wreq) at the boundary, then map to your domain error type. A thrown JSONError deep inside a worker thread is much harder to attribute than a Left at the call site.
Ignoring response timeouts. The default request timeout is generous. A hung upstream without an explicit responseTimeout will hold a worker indefinitely; set it per request, below your own inbound request timeout so failures surface as upstream errors rather than client timeouts.
Assuming cookie persistence is automatic. wreq sessions persist cookies; http-client and req do not maintain a cookie jar for you. If you are scripting a login flow, that difference decides the library.
Migration and Coexistence Strategies
The realistic path for most teams is http-client → req for new code, keeping the engine underneath for anything that needs transport-level control. Both use the same TLS stack, so there is no dependency conflict; the two coexist cleanly in one cabal project.
From wreq → req, expect the lens usage to be the hard part, not the HTTP calls. Rewrite module by module, starting with the simplest GET-plus-JSON cases, and leave multipart and SigV4 paths on wreq until last — those are exactly where wreq still earns its place.
From req → http-client is rare and usually driven by a library requirement: you need your own Manager, or you need to expose streaming bodies. In that case keep req at the edges of the application and use the engine only in the layer that needs it.
Whatever you choose, keep the client behind a small interface of your own. A type Api = ... record of functions or a class MonadApi m means swapping clients touches one module — the same discipline that makes Haskell effect systems manageable when you add a new capability to the stack. If your responses are large, pair the client with a streaming library rather than materialising bodies — our Haskell streaming comparison covers the trade-offs, and the Haskell serialization comparison is the right companion when you decide how to decode what comes back. Teams evaluating the same decision in another ecosystem will recognise the shape of it from our Python HTTP clients comparison.
FAQ
Is http-client still maintained in 2026?
Yes. Version 0.7.19 was released with mockable transport support via requestAction, and the repository was last pushed in June 2026. It remains the foundation that wreq, http-conduit and much of the Haskell ecosystem build on.
Do I need http-conduit to use http-client?
Not strictly. http-client gives you Request, Response, Manager and httpLbs; http-conduit adds the Network.HTTP.Simple convenience layer with httpLBS, httpJSON and httpNoBody. Most tutorials use the Simple API, which is why people assume it ships with the engine.
Which library handles HTTPS out of the box?
wreq and req do. Plain http-client does not — you must add http-client-tls or http-client-openssl and use a TLS-aware manager such as newTlsManager.
Does req retry failed requests automatically?
Yes, it retries on timeouts and certain connection errors by default. That is why you should not add an outer retry wrapper around req calls; configure retry behaviour in the request configuration instead, or you will multiply attempts.
Can I use req in a custom monad stack?
Yes, that is what the MonadHttp constraint is for. Any monad with an instance can run requests, and runReq defaultHttpConfig lets you run in IO-based stacks without defining an instance.
Which one should I use for AWS S3 or signed requests?
wreq has documented AWS Signature Version 4 support and multipart upload handling, which makes it the shortest path. With req or http-client you would implement signing yourself.
💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com