async function resolve()

in apps/mountebank-mock/mountebank-source/src/models/responseResolver.js [339:360]


    async function resolve (responseConfig, request, logger, imposterState, options) {
        if (hasMultipleTypes(responseConfig)) {
            return Promise.reject(exceptions.ValidationError('each response object must have only one response type',
                { source: responseConfig }));
        }

        let response = await processResponse(responseConfig, helpers.clone(request), logger, imposterState, options);

        // We may have already run the behaviors in the proxy call to persist the decorated response
        // in the new stub. If so, we need to ensure we don't re-run it
        // If we're doing fault simulation there's no need to execute the behaviours
        if (!responseConfig.proxy && !responseConfig.fault) {
            response = await behaviors.execute(request, response, responseConfig.behaviors, logger, imposterState);
        }

        if (inProcessProxy) {
            return response;
        }
        else {
            return responseConfig.proxy ? response : { response };
        }
    }