From 3fedbd097a8ccbdb16b2643ac305832cefa77557 Mon Sep 17 00:00:00 2001 From: Joshua McCartney Date: Thu, 28 Sep 2017 19:15:53 -0400 Subject: [PATCH] Fix issue #821 --- servant-client/src/Servant/Client/Internal/HttpClient.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/servant-client/src/Servant/Client/Internal/HttpClient.hs b/servant-client/src/Servant/Client/Internal/HttpClient.hs index e61b29e3..d116b443 100644 --- a/servant-client/src/Servant/Client/Internal/HttpClient.hs +++ b/servant-client/src/Servant/Client/Internal/HttpClient.hs @@ -136,12 +136,16 @@ requestToClientRequest burl r = Client.defaultRequest let orig = toList $ requestHeaders r in maybe orig (: orig) contentTypeHdr , Client.requestBody = body + , Client.secure = isSecure } where (body, contentTypeHdr) = case requestBody r of Nothing -> (Client.RequestBodyLBS "", Nothing) Just (RequestBodyLBS body', typ) -> (Client.RequestBodyLBS body', Just (hContentType, renderHeader typ)) + isSecure = case baseUrlScheme burl of + Http -> False + Https -> True catchConnectionError :: IO a -> IO (Either ServantError a) catchConnectionError action =