Sridhar Ratnakumar
Sridhar Ratnakumar

Reputation: 85462

Disable SSL certificate validation in Haskell `req` library

How to disable SSL certificate validation when using the Haskell req library? Similar to curl -k.

Upvotes: 1

Views: 382

Answers (1)

Sridhar Ratnakumar
Sridhar Ratnakumar

Reputation: 85462

import Network.Connection (TLSSettings (TLSSettingsSimple))
import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (mkManagerSettings)
import Network.HTTP.Req

main = do
  myManager <- newManager $ mkManagerSettings (TLSSettingsSimple True False False) Nothing
  let httpConfig = def { httpConfigAltManager = Just myManager }
  runReq httpConfig $ do
    req POST -- ...

Upvotes: 3

Related Questions