RunCassetteRequestHandler() public method

public RunCassetteRequestHandler ( Nancy.NancyContext context ) : Response
context Nancy.NancyContext
return Nancy.Response
Ejemplo n.º 1
0
        private Response RunCassetteRequestHandler(NancyContext context)
        {
            logger.Debug("RunCassetteRequestHandler starting");
            currentContext.Value = context;

            // Some parts of WebHost initialization require a valid NancyContext, so defer
            // creation of the WebHost until the first request hits the pipeline.
            if (webHost == null)
            {
                logger.Debug("WebHost is null, acquiring lock...");

                lock (webHostLocker) {
                    logger.Debug("I have the lock...");

                    if (webHost == null)
                    {
                        logger.Debug("I have the lock and webHost is still null. Creating/initing it...");
                        webHost = new WebHost(rootPathProvider, () => currentContext.Value);
                        webHost.Initialize();
                        logger.Debug("...finished creating/initing webHost.");
                    }
                }
            }

            logger.Debug("RunCassetteRequestHandler - running request handler.");
            return(webHost.RunCassetteRequestHandler(context));
        }
Ejemplo n.º 2
0
        private Response RunCassetteRequestHandler(NancyContext context)
        {
            currentContext.Value = context;

            // Some parts of WebHost initialization require a valid NancyContext, so defer
            // creation of the WebHost until the first request hits the pipeline.
            if (webHost == null)
            {
                webHost = new WebHost(rootPathProvider, () => currentContext.Value);
                webHost.Initialize();
            }

            return(webHost.RunCassetteRequestHandler(context));
        }