File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,14 @@ request :: forall eff. Options RequestOptions -> (Response -> Eff (http :: HTTP
101101
102102Make a HTTP request using the specified options and response callback.
103103
104+ #### ` requestFromURI `
105+
106+ ``` purescript
107+ requestFromURI :: forall eff. String -> (Response -> Eff (http :: HTTP | eff) Unit) -> Eff (http :: HTTP | eff) Request
108+ ```
109+
110+ Make a HTTP request from a URI string and response callback.
111+
104112#### ` requestAsStream `
105113
106114``` purescript
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module Node.HTTP.Client
1313 , headers
1414 , auth
1515 , request
16+ , requestFromURI
1617 , requestAsStream
1718 , responseAsStream
1819 , httpVersion
@@ -83,6 +84,10 @@ foreign import requestImpl :: forall eff. Foreign -> (Response -> Eff (http :: H
8384request :: forall eff . Options RequestOptions -> (Response -> Eff (http :: HTTP | eff ) Unit ) -> Eff (http :: HTTP | eff ) Request
8485request = requestImpl <<< options
8586
87+ -- | Make a HTTP request from a URI string and response callback.
88+ requestFromURI :: forall eff . String -> (Response -> Eff (http :: HTTP | eff ) Unit ) -> Eff (http :: HTTP | eff ) Request
89+ requestFromURI = requestImpl <<< toForeign
90+
8691-- | Create a writable stream from a request object.
8792requestAsStream :: forall eff r a . Request -> Writable r (http :: HTTP | eff ) a
8893requestAsStream = unsafeCoerce
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ main = do
1818 server <- createServer respond
1919 listen server 8080 $ void do
2020 log " Listening on port 8080."
21- req <- Client .request ( Client .hostname := " localhost" <> Client .port := 8080 ) \response -> void do
21+ req <- Client .requestFromURI " http:// localhost: 8080/ " \response -> void do
2222 log " Response from GET /:"
2323 let responseStream = Client .responseAsStream response
2424 pipe responseStream stdout
You can’t perform that action at this time.
0 commit comments