How to disable SSL certificate validation when using the Haskell req
library? Similar to curl -k
.
Asked
Active
Viewed 341 times
1

duplode
- 33,731
- 7
- 79
- 150

Sridhar Ratnakumar
- 81,433
- 63
- 146
- 187
1 Answers
3
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 -- ...

Sridhar Ratnakumar
- 81,433
- 63
- 146
- 187
-
what is `def` ? `def` should be `defaultHttpConfig` – Shawn Zhang Jan 25 '22 at 16:43