我想使用Snap框架向外部API发送http请求。 Snap是否支持它?如果没有,怎么去呢?
答案 0 :(得分:2)
您是否看过使用Network.Wreq
?
import qualified Data.ByteString.Lazy as LAZ
import qualified Data.ByteString.Lazy.Char8 as CHA
makeRequest :: IO (Network.Wreq.Response LAZ.ByteString)
makeRequest = do
res <- get "https://www.example.com"
let resBody = res ^. responseBody :: CHA.ByteString
return (resBody)
使用简单的镜头语法并支持HTTP和HTTPS。