aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Web/OpenWeatherMap/Client.hs10
-rw-r--r--openweathermap.cabal2
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/Web/OpenWeatherMap/Client.hs b/lib/Web/OpenWeatherMap/Client.hs
index 31719bb..d9fdb18 100644
--- a/lib/Web/OpenWeatherMap/Client.hs
+++ b/lib/Web/OpenWeatherMap/Client.hs
@@ -6,12 +6,12 @@ module Web.OpenWeatherMap.Client
, getForecast
) where
-import Network.HTTP.Client (defaultManagerSettings, newManager)
+import Network.HTTP.Client.TLS (newTlsManager)
import Servant.Client
( BaseUrl(BaseUrl)
, ClientEnv
, ClientError
- , Scheme(Http)
+ , Scheme(Https)
, mkClientEnv
, runClientM
)
@@ -40,10 +40,8 @@ getForecast appid loc =
defaultEnv :: IO ClientEnv
defaultEnv = do
- manager <- newManager defaultManagerSettings
+ manager <- newTlsManager
return $ mkClientEnv manager baseUrl
--- XXX openweathermap.org does not support HTTPS,
--- XXX appid is passed in clear text. Oops.
baseUrl :: BaseUrl
-baseUrl = BaseUrl Http "api.openweathermap.org" 80 "/data/2.5"
+baseUrl = BaseUrl Https "api.openweathermap.org" 443 "/data/2.5"
diff --git a/openweathermap.cabal b/openweathermap.cabal
index 6dbdfe8..d3ba84e 100644
--- a/openweathermap.cabal
+++ b/openweathermap.cabal
@@ -49,7 +49,7 @@ library
aeson -any,
bytestring -any,
http-api-data -any,
- http-client -any,
+ http-client-tls -any,
servant -any,
servant-client >=0.19,
servant-client-core -any,