Ejemplo n.º 1
0
        public IContext Process(TestRequest request) {
            var requestEnvironment = OwinFactory.CreateScopedEnvironment(_host.Environment);

            var context = OwinContext.Get(requestEnvironment);
            context.Request.PathBase = string.Empty;
            context.Request.Method = request.RequestLine.Method;
            context.Request.FullUri = request.Url;
            context.Request.Protocol = request.RequestLine.HttpVersion;
            context.Request.Headers.MergeIn(request.Headers);
            context.Request.Body = request.Body != null ? new MemoryStream(request.Body, false) : Stream.Null;

            context.Response.Body = new MemoryStream();

            _appFunc(requestEnvironment)
                .Wait();

            return context;
        }
Ejemplo n.º 2
0
        public IContext Process(TestRequest request)
        {
            var requestEnvironment = OwinFactory.CreateScopedEnvironment(_host.Environment);

            var context = OwinContext.Get(requestEnvironment);

            context.Request.PathBase = string.Empty;
            context.Request.Method   = request.RequestLine.Method;
            context.Request.FullUri  = request.Url;
            context.Request.Protocol = request.RequestLine.HttpVersion;
            context.Request.Headers.MergeIn(request.Headers);
            context.Request.Body = request.Body != null ? new MemoryStream(request.Body, false) : Stream.Null;

            context.Response.Body = new MemoryStream();

            _appFunc(requestEnvironment)
            .Wait();

            return(context);
        }
Ejemplo n.º 3
0
 public IContext ProcessGet(string url)
 {
     return(Process(TestRequest.Get(url)));
 }