Class Index | File Index

Classes


Class Server


Defined in: httpserver.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Server(requestHandler)
Encapsulates a simple HTTP server for testing.
Field Summary
Field Attributes Field Name and Description
<inner>  
Method Summary
Method Attributes Method Name and Description
 
 
host()
return {string} The host:port of this server.
 
start(opt_port)
Starts the server on the given port.
 
stop()
Stops the server.
 
url(opt_pathname)
Formats a URL for this server.
Class Detail
Server(requestHandler)
Encapsulates a simple HTTP server for testing. The {@code onrequest} function should be overridden to define request handling behavior.
Parameters:
{function(!http.ServerRequest|!http.ServerResponse)} requestHandler
The request handler for the server.
Field Detail
<inner> Host
Method Detail
{Host} address()
Throws:
{Error}
If the server is not running.
Returns:
{Host} This server's host info.

host()
return {string} The host:port of this server.
Throws:
{Error}
If the server is not running.

{!webdriver.promise.Promise.} start(opt_port)
Starts the server on the given port. If no port, or 0, is provided, the server will be started on a random port.
Parameters:
{number=} opt_port
The port to start on.
Returns:
{!webdriver.promise.Promise.} A promise that will resolve with the server host when it has fully started.

{!webdriver.promise.Promise} stop()
Stops the server.
Returns:
{!webdriver.promise.Promise} A promise that will resolve when the server has closed all connections.

{string} url(opt_pathname)
Formats a URL for this server.
Parameters:
{string=} opt_pathname
The desired pathname on the server.
Throws:
{Error}
If the server is not running.
Returns:
{string} The formatted URL.

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Jan 25 2014 14:42:01 GMT-0500 (EST)