Module: models/foo/fooServer

A sample protocol implementation, used for demo purposes only

Source:

Methods

(inner) createServer(baseLogger, options, recordRequests, debug) → {Object}

Spins up a server listening on a socket

Parameters:
Name Type Description
baseLogger object

the base logger

options Object

the JSON request body for the imposter create request

recordRequests boolean

The --mock command line parameter

debug boolean

The --debug command line parameter

Source:
Returns:

The protocol server implementation

Type
Object

(inner) initialize(logger, allowInjection, recordRequests, debug) → {Object}

Creates the core protocol interface - all protocols must implement

Parameters:
Name Type Description
logger object

the base logger

allowInjection boolean

represents the command line --allowInjection parameter

recordRequests boolean

represents the command line --mock parameter

debug boolean

represents the command line --debug parameter

Source:
Returns:

The server factory

Type
Object

(inner) postProcess(response) → {Object}

Used to fill in defaults for the response. A user may set up a response
with not all fields filled in, and we use this function to fill in the rest

Parameters:
Name Type Description
response Object

The response returned by the stub

Source:
Returns:
  • The response we will send back
Type
Object

(inner) scopeFor(port, nameopt) → {string}

Used to get consistent logging look & feel

Parameters:
Name Type Attributes Description
port number

The port for the imposter

name string <optional>

The name of the imposter

Source:
Returns:
Type
string