ServerJS/HTTP Client/A: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 32: Line 32:


After connecting, write() will have no effect.
After connecting, write() will have no effect.
Calling connect() SHOULD NOT block the application, but MUST initiate the HTTP request.


=== read() ===
=== read() ===


Read the request and return a JSGI-style object consisting of <code>{status:Integer, headers:Objecct, body:Iterable<ByteString>}</code>.
Read the request and return a JSGI-style object consisting of <code>{status:Integer, headers:Objecct, body:Iterable<ByteString>}</code>.
Calling read() SHOULD NOT block the application until the request is completed, but it MUST open the input stream such that the data can be read.


=== finish() ===
=== finish() ===
Line 90: Line 94:


Default value: none
Default value: none
== Example Implementation ==
* Isaac's Narwhal branch on github: [http://github.com/isaacs/narwhal/blob/master/lib/http-client.js code], [http://github.com/isaacs/narwhal-playground/blob/master/http-client.js usage]