$ cnpm install q-http
Provides a Q promise API for HTTP requests and responses. This should resemble JSGI and its hypothetical inverse, but I haven't pored through the specification to ensure this.
Server(app)
listen(port)
stop()
request(request)
read(request)
normalizeRequest(request)
forEach into proper response objects.undefined through as a signal that a request
will not receive a response directly.url the full URL of the request as a stringpath the full path as a stringscriptName the routed portion of the path, like "" for
http://example.com/ if no routing has occurred.pathInfo the part of the path that remains to be routed,
like / for http://example.com or http://example.com/
if no routing has occurred.version the requested HTTP version as an array of strings.method like "GET"scheme like "http:"host like "example.com"port the port number, like 80remoteHostremotePortheaders
corresponding values, possibly an array for multiple headers
of the same name.bodynode the wrapped Node request objectstatus the HTTP status code as a number, like 200.headersbodyonclose is an optional function that this library will call
when a response concludes.node the wrapped Node response object.forEach(callback)
callback(chunk) function
BufferforEach function for arrays of strings or buffers is
sufficient for user-provided bodiesforEach function is the only necessary function for
bodies provided to this library.forEach, bodies provided by this library
support the entire readable stream interface provided by
q-io.read()
Copyright 2009, 2010, 2011 Kristopher Michael Kowal MIT License (enclosed)
Copyright 2013 - present © cnpmjs.org | Home |