June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
27
Task/HTTPS-Authenticated/Haskell/https-authenticated.hs
Normal file
27
Task/HTTPS-Authenticated/Haskell/https-authenticated.hs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Main (main) where
|
||||
|
||||
import Data.Aeson (Value)
|
||||
import Data.Default.Class (def)
|
||||
import Network.HTTP.Req
|
||||
( (/:)
|
||||
, GET(..)
|
||||
, NoReqBody(..)
|
||||
, basicAuth
|
||||
, https
|
||||
, jsonResponse
|
||||
, req
|
||||
, responseBody
|
||||
, runReq
|
||||
)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
response <- runReq def $ req
|
||||
GET
|
||||
(https "httpbin.org" /: "basic-auth" /: "someuser" /: "somepassword")
|
||||
NoReqBody
|
||||
jsonResponse
|
||||
(basicAuth "someuser" "somepassword")
|
||||
print (responseBody response :: Value)
|
||||
Loading…
Add table
Add a link
Reference in a new issue