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

Dimensionhttp-clientwreqreq
LayerLow-level engineConvenience layer over http-clientIndependent client
GitHub stars298383353
Last push2026-06-102026-03-152026-12-02
Latest version0.7.190.5.4.53.13.4
LicenseMITBSD-3-ClauseBSD-3-Clause
TLS includedNo — needs http-client-tls / -opensslYes (via TLS backend)Yes, built in
URL safetyString / RequestStringType-safe combinators (https, /:)
API styleRecords plus settersLenses (&, .~, ^.)Monadic DSL in MonadHttp
Retry on timeoutManualManualAutomatic
JSONVia http-conduit (httpJSON)asJSON, asValuejsonResponse, ReqBodyJson
Connection managerExplicit, shareableShared internallySingle implicit global
Tested withBroad GHC rangeGHC 8.x–9.xGHC 9.10.3, 9.12.4, 9.14.1
Learning curveMediumHigh (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 situationUseWhy
New web service calling third-party APIsreqType-safe URLs plus built-in retry behaviour
Writing a reusable HTTP libraryhttp-clientStable engine API, minimal dependencies
Heavy JSON response handlingwreq or reqwreq for lens traversal, req for typed decoding
Multipart file uploadswreqDocumented multipart support with lens composition
AWS SigV4 signed requestswreqBuilt-in AWS request signing
Strict dependency budgethttp-clientNo lens, no extra layers
Existing codebase already uses lenseswreqZero friction, idioms match
Streaming a large response bodyhttp-clientwithResponse gives you incremental body access
Test suites with mocked transportreq (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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
-- stack script --resolver lts-12.21
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Lazy.Char8 as L8
import           Network.HTTP.Simple

main :: IO ()
main = do
    response <- httpLBS "http://httpbin.org/get"

    putStrLn $ "The status code was: " ++
               show (getResponseStatusCode response)
    print $ getResponseHeader "Content-Type" response
    L8.putStrLn $ getResponseBody response

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 makes https:// URLs work.
  • http-conduit — the friendly Network.HTTP.Simple wrapper with httpLBS, httpJSON, httpNoBody.

JSON decoding is a one-liner through the wrapper:

1
2
3
4
5
6
7
import           Data.Aeson (Value)
import           Network.HTTP.Simple

main :: IO ()
main = do
    response <- httpJSON "http://httpbin.org/get"
    print (getResponseBody response :: Value)

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:

1
2
3
4
5
6
7
8
9
import Network.HTTP.Client
import Network.HTTP.Client.TLS (newTlsManager)

main :: IO ()
main = do
  manager <- newTlsManager          -- shared across all requests
  request <- parseRequest "https://api.example.com/health"
  response <- httpLbs request { responseTimeout = responseTimeoutMicro 2000000 } manager
  print (responseStatus response)

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.

1
2
3
4
5
6
7
8
9
{-# LANGUAGE OverloadedStrings #-}
import Control.Lens ((&), (^.), (.~))
import Network.Wreq

main :: IO ()
main = do
  let opts = defaults & param "foo" .~ ["bar"]
  r <- getWith opts "http://httpbin.org/get"
  print (r ^. responseStatus)

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:

1
2
3
let opts = defaults & header "Accept" .~ ["application/json"]
                    & param "page" .~ ["2"]
r <- asJSON =<< getWith opts "https://api.example.com/items"

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data GetBody = GetBody
  { headers :: Map Text Text
  , args    :: Map Text Text
  , origin  :: Text
  , url     :: Text
  } deriving (Show, Generic)

instance FromJSON GetBody

basic_asJSON :: IO ()
basic_asJSON = do
  let opts = defaults & param "foo" .~ ["bar"]
  r <- asJSON =<< getWith opts "http://httpbin.org/get"
  putStrLn $ "args: " ++ show (args (r ^. responseBody))

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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE OverloadedStrings #-}

module Main (main) where

import Control.Monad.IO.Class
import Data.Aeson
import Network.HTTP.Req

main :: IO ()
main = runReq defaultHttpConfig $ do
  let payload = object ["foo" .= (10 :: Int), "bar" .= (20 :: Int)]
  r <-
    req
      POST
      (https "httpbin.org" /: "post")
      (ReqBodyJson payload)
      jsonResponse
      mempty
  liftIO $ print (responseBody r :: Value)

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 payload sets the content type and encodes the body in one step.
  • jsonResponse is a response reader; swapping it for ignoreResponse makes the body handling explicit rather than accidental.
  • mempty is 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:

  1. Automatic retrying. req retries on timeouts and certain connection failures by default. That is usually what you want, and it is also why you should not wrap req calls in your own retry loop — you will multiply attempts without noticing. Set retry counts in the config instead.
  2. MonadHttp is the test seam. Any monad with a MonadHttp instance 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 to IO.

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