@@ -7,12 +7,12 @@ import Control.Monad.Eff.Console (CONSOLE, log, logShow)
7
7
8
8
import Data.Foldable (foldMap )
9
9
import Data.Maybe (Maybe (..))
10
- import Data.Options (Options , (:=))
10
+ import Data.Options (Options , options , (:=))
11
11
12
12
import Node.Encoding (Encoding (..))
13
13
import Node.HTTP (HTTP , Request , Response , listen , createServer , setHeader , requestMethod , requestURL , responseAsStream , requestAsStream , setStatusCode )
14
14
import Node.HTTP.Client as Client
15
- import Node.HTTP.HTTPS as HTTPS
15
+ import Node.HTTP.Secure as HTTPS
16
16
import Node.Stream (Writable , end , pipe , writeString )
17
17
18
18
import Partial.Unsafe (unsafeCrashWith )
@@ -141,12 +141,12 @@ simpleReq uri = do
141
141
end (Client .requestAsStream req) (pure unit)
142
142
143
143
complexReq :: 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
147
147
end (Client .requestAsStream req) (pure unit)
148
148
where
149
- opts = unsafeCoerce options
149
+ optsR = unsafeCoerce $ options opts
150
150
151
151
logResponse :: forall eff . Client.Response -> Eff (console :: CONSOLE , http :: HTTP | eff ) Unit
152
152
logResponse response = void do
0 commit comments