Babra Cunningham Babra Cunningham - 8 months ago 62
HTTP Question

simpleHttp causing 'unsupported browser response?'

I'm executing a simpleHttp request to a https domain, yet the response html is showing 'unsupported browser' messages -- i believe this is because simpleHttp does not support HTTPS.

My function:

import Network.HTTP.Simple

makeRequest :: IO LAZ.ByteString
makeRequest = do
response <- simpleHttp ""
return (response)

Which haskell libraries support https?

Answer Source

Wreq provides a very easy to follow tutorial on http/s requests using basic lens syntax.

A https compatible request is as simple as:

main = do
  r <- get ""

Response statuses and bodies can be accessed respectively:

  r ^. responseStatus . statusCode
  r ^. responseBody