HttpTestServer
Last updated
Last updated
Http server to help the systemtest visualize http calls.
Param | Type | Description |
---|---|---|
Start the http server.
Listening on specified port.
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.
string
Gets the server host.
Returns: string
- networkInterfaceAddress - A string with the address for the eth0 network
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
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.
Param | Type | Default | Description |
---|---|---|---|
Param | Type | Description |
---|---|---|
params
Object
Required - The params object containing properties passed to the constructor
params.port
number
Required - Port number to start the Http server on
params.enableHealthEndpointAt
string
Required - Url string with the endpoint to the healthcheck
endpoint
string
Required - Url string with the endpoint to either resolve or put on a queue
params
Object
{}
Object with params to the request. Example: treatContentTypeAs: 'application/json'
request
Object
Required - Request object with the incoming http call
response
Object
Required - Response object to respond to the incoming http call