Manages the connection to the service, issuing requests against it. Relies on
Node's http
module for the actual connections.
Throws a TypeError
instance if options is provided, but is not an
object.
Sets the hostname
property.
Sets the port
property.
Sets the agent
property. Passed to Node's http
module.
The domain or IP address of the service endpoint. Defaults to localhost
.
Subclasses can set a default value on the prototype or instance before the base constructor is called.
The port the service is listening on. Defaults to 80
.
Subclasses can set a default value on the prototype or instance before the base constructor is called.
Controls agent behavior.
Subclasses can set a default value on the prototype or instance before the base constructor is called.
Calls out to Node's http
module to make a ClientRequest
instance. Can
be overriden, for instance SslTransport
changes
this method to use the https
module.
Expects to be called with an options
object containing hostname
, port
,
agent
, method
, path
, headers
and auth
properties.
Issues a request against the connected service. Expects the descriptior
object to have method
, path
, headers
and auth
properties.
Returns a promise for the service response. If the request emits an error
event, the promise is rejected with that error. If the promise is cancelled
the request is aborted.
If the descriptor
contains a body
object with a stream
property,
that stream is piped to the request. Or if it contains a chunk
property, that buffer is written to the request. Else the request is
closed immediately.
UnencryptedTransport([options])