increase POST request timeout
This commit is contained in:
parent
8bb7f413bf
commit
e290dac0c3
|
@ -25,6 +25,7 @@ import Network.HTTP.Client
|
||||||
( newManager
|
( newManager
|
||||||
, managerSetMaxHeaderLength
|
, managerSetMaxHeaderLength
|
||||||
, httpLbs
|
, httpLbs
|
||||||
|
, responseTimeoutNone
|
||||||
)
|
)
|
||||||
import qualified Data.ByteString.Lazy.Char8 as BL
|
import qualified Data.ByteString.Lazy.Char8 as BL
|
||||||
import Network.HTTP.Client.Conduit (defaultManagerSettings)
|
import Network.HTTP.Client.Conduit (defaultManagerSettings)
|
||||||
|
@ -90,8 +91,9 @@ post
|
||||||
-> IO (Either HttpError LBS.ByteString)
|
-> IO (Either HttpError LBS.ByteString)
|
||||||
post settings path payload return_repr = do
|
post settings path payload return_repr = do
|
||||||
let requestUrl = T.postgrest_url settings ++ path
|
let requestUrl = T.postgrest_url settings ++ path
|
||||||
initReq <- parseRequest requestUrl
|
req <- parseRequest requestUrl
|
||||||
let req = setRequestMethod "POST"
|
let initReq = setRequestResponseTimeout responseTimeoutNone req
|
||||||
|
let request = setRequestMethod "POST"
|
||||||
. setRequestHeader "Authorization" [ jwt_header ]
|
. setRequestHeader "Authorization" [ jwt_header ]
|
||||||
. setRequestHeader "Content-Type" [ "application/json" ]
|
. setRequestHeader "Content-Type" [ "application/json" ]
|
||||||
. setRequestBodyLBS payload
|
. setRequestBodyLBS payload
|
||||||
|
@ -100,7 +102,7 @@ post settings path payload return_repr = do
|
||||||
|
|
||||||
putStrLn $ "posting to " ++ requestUrl
|
putStrLn $ "posting to " ++ requestUrl
|
||||||
-- putStrLn $ "Payload: " ++ (LC8.unpack payload)
|
-- putStrLn $ "Payload: " ++ (LC8.unpack payload)
|
||||||
handleHttp (httpLBS req)
|
handleHttp (httpLBS request)
|
||||||
|
|
||||||
where
|
where
|
||||||
jwt_header = C8.pack $ "Bearer " ++ T.jwt settings
|
jwt_header = C8.pack $ "Bearer " ++ T.jwt settings
|
||||||
|
|
Loading…
Reference in New Issue