public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object state)
        {
            var wrappedContext = new HttpContextWrapper(context);
            var handler        = new NancyHandler(engine);

            return(handler.ProcessRequest(wrappedContext, cb, state));
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            var wrappedContext = new HttpContextWrapper(context);
            var handler        = new NancyHandler(engine);

            handler.ProcessRequest(wrappedContext);
        }
 public void ProcessRequest(HttpContext context)
 {
     Try(() =>
     {
         var wrappedContext = new HttpContextWrapper(context);
         var handler = new NancyHandler(engine);
         handler.ProcessRequest(wrappedContext);
     });
 }
Esempio n. 4
0
        public static void EndProcessRequest(Task <Tuple <NancyContext, HttpContextBase> > task)
        {
            if (task.IsFaulted)
            {
                var exception = task.Exception;
                exception.Handle(ex => ex is HttpException);
            }

            var nancyContext = task.Result.Item1;
            var httpContext  = task.Result.Item2;

            NancyHandler.SetNancyResponseToHttpResponse(httpContext, nancyContext.Response);
            nancyContext.Dispose();
        }
        public void EndProcessRequest(IAsyncResult result)
        {
            var task = (Task <Tuple <NancyContext, HttpContextBase> >)result;

            if (task.IsFaulted)
            {
                var exception = task.Exception;
                exception.Handle(ex => ex is HttpException);
            }

            var nancyContext = task.Result.Item1;
            var httpContext  = task.Result.Item2;

            NancyHandler.SetNancyResponseToHttpResponse(httpContext, nancyContext.Response);
        }
Esempio n. 6
0
        public NancyHandlerFixture()
        {
            this.context = A.Fake<HttpContextBase>();
            this.request = A.Fake<HttpRequestBase>();
            this.response = A.Fake<HttpResponseBase>();
            this.engine = A.Fake<INancyEngine>();
            this.handler = new NancyHandler(engine);
            this.formData = new NameValueCollection();

            A.CallTo(() => this.request.Form).ReturnsLazily(() => this.formData);
            A.CallTo(() => this.request.Url).Returns(new Uri("http://www.foo.com"));
            A.CallTo(() => this.request.InputStream).Returns(new MemoryStream());
            A.CallTo(() => this.request.Headers).Returns(new NameValueCollection());
            A.CallTo(() => this.request.AppRelativeCurrentExecutionFilePath).Returns("~/foo");

            A.CallTo(() => this.context.Request).Returns(this.request);
            A.CallTo(() => this.context.Response).Returns(this.response);
            A.CallTo(() => this.response.OutputStream).Returns(new MemoryStream());
        }
 public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object state)
 {
     var wrappedContext = new HttpContextWrapper(context);
     var handler = new NancyHandler(engine);
     return handler.ProcessRequest(wrappedContext, cb, state);
 }
        public override Task ProcessRequestAsync(HttpContext context)
        {
            var nancyHandler = new NancyHandler(engine);

            return nancyHandler.ProcessRequest(new HttpContextWrapper(context));
        }
        public override Task ProcessRequestAsync(HttpContext context)
        {
            var nancyHandler = new NancyHandler(engine);

            return nancyHandler.ProcessRequest(new HttpContextWrapper(context));
        }
Esempio n. 10
0
 public void EndProcessRequest(IAsyncResult result)
 {
     NancyHandler.EndProcessRequest((Task <Tuple <NancyContext, HttpContextBase> >)result);
 }