Module: models/responseResolver

Determines the response for a stub based on the user-provided response configuration

Source:

Methods

resolve(responseConfig, request, logger, imposterState, options) → {Object}

Resolves a single response

Parameters:
Name Type Description
responseConfig Object

The API-provided response configuration

request Object

The protocol-specific request object

logger Object

The logger

imposterState Object

The current state for the imposter

options Object

Additional options not carried with the request

Source:
Returns:
  • Promise resolving to the response
Type
Object

resolveProxy(proxyResponse, proxyResolutionKey, logger, imposterState) → {Object}

Finishes the protocol implementation dance for proxy. On the first call,
mountebank selects a JSON proxy response and sends it to the protocol implementation,
saving state indexed by proxyResolutionKey. The protocol implementation sends the proxy
to the downstream system and calls mountebank again with the response so mountebank
can save it and add behaviors

Parameters:
Name Type Description
proxyResponse Object

the proxy response from the protocol implementation

proxyResolutionKey Number

the key into the saved proxy state

logger Object

the logger

imposterState Object

the user controlled state variable

Source:
Returns:
  • Promise resolving to the response
Type
Object

(inner) create(stubs, proxy, callbackURL) → {Object}

Creates the resolver

Parameters:
Name Type Description
stubs Object

The stubs repository

proxy Object

The protocol-specific proxy implementation

callbackURL String

The protocol callback URL for response resolution

Source:
Returns:
Type
Object