HttpTestServer

HttpTestServer{#HttpTestServer}

HttpTestServer{#HttpTestServer}

Http server to help the systemtest visualize http calls.

new HttpTestServer(params)

start()

Start the http server.

Listening on specified port.

stop()

Stop the Http server.

Checks if there are any http calls left to respond to or endpoints waiting for calls, responds to these endpoints and then stops the server.

Throws errror if there are leftover calls not handled before shutdown.

getServerHost() {#getServerHost}⇒ string

Gets the server host.

Returns: string - networkInterfaceAddress - A string with the address for the eth0 network

waitForCall(endpoint, [params]) {#waitForCall}⇒ Promise.<Object>

Gets an endpoint to handle. Checks if an endpoint is waiting for an answer and resolves an answer to it.

Or puts the endpoint on a queue to be handled when a request for that endpoints comes in.

Returns: Promise.<Object> - Promise object represents the object with resolve, reject and params to resolve the incoming http call

onHttpCall(request, response) {#onHttpCall}⇒ Promise.<Object> | void

Handles all incoming Http calls

Either puts the request on queue to be handled or responds with data.

Returns: Promise.<Object> | void - Promise object represents an object with the data from the request or, returns void and puts the request in queue.

Last updated