@@ -7,12 +7,12 @@ import Control.Monad.Eff.Console (CONSOLE, log, logShow)
77
88import Data.Foldable (foldMap )
99import Data.Maybe (Maybe (..))
10- import Data.Options (Options , (:=))
10+ import Data.Options (Options , options , (:=))
1111
1212import Node.Encoding (Encoding (..))
1313import Node.HTTP (HTTP , Request , Response , listen , createServer , setHeader , requestMethod , requestURL , responseAsStream , requestAsStream , setStatusCode )
1414import Node.HTTP.Client as Client
15- import Node.HTTP.HTTPS as HTTPS
15+ import Node.HTTP.Secure as HTTPS
1616import Node.Stream (Writable , end , pipe , writeString )
1717
1818import Partial.Unsafe (unsafeCrashWith )
@@ -141,12 +141,12 @@ simpleReq uri = do
141141 end (Client .requestAsStream req) (pure unit)
142142
143143complexReq :: forall eff . Options Client.RequestOptions -> Eff (console :: CONSOLE , http :: HTTP | eff ) Unit
144- complexReq options = do
145- log $ opts .method <> " " <> opts. hostname <> opts .path <> " :"
146- req <- Client .request options logResponse
144+ complexReq opts = do
145+ log $ optsR .method <> " " <> optsR.protocol <> " // " <> optsR. hostname <> " : " <> optsR.port <> optsR .path <> " :"
146+ req <- Client .request opts logResponse
147147 end (Client .requestAsStream req) (pure unit)
148148 where
149- opts = unsafeCoerce options
149+ optsR = unsafeCoerce $ options opts
150150
151151logResponse :: forall eff . Client.Response -> Eff (console :: CONSOLE , http :: HTTP | eff ) Unit
152152logResponse response = void do
0 commit comments