public void Dispose(ProtoContext httpContext)
 {
     if (_httpContextAccessor != null)
     {
         _httpContextAccessor.ProtoContext = null;
     }
 }
        public async Task WritingText_WriteText()
        {
            ProtoContext context = CreateRequest();
            await context.Response.WriteAsync("Hello World");

            Assert.Equal(11, context.Response.Body.Length);
        }
Ejemplo n.º 3
0
            public async Task InvokeAsync(ProtoContext context, RequestDelegate next)
            {
                context.Items["before"] = true;
                await next(context);

                context.Items["after"] = true;
            }
Ejemplo n.º 4
0
 void TestAllCachedFeaturesAreSet(ProtoContext context, IFeatureCollection features)
 {
     TestCachedFeaturesAreSet(context, features);
     TestCachedFeaturesAreSet(context.Request, features);
     TestCachedFeaturesAreSet(context.Response, features);
     TestCachedFeaturesAreSet(context.Connection, features);
     TestCachedFeaturesAreSet(context.GameSockets, features);
 }
        public async Task WritingTextWithPassedInEncodingWorks(Encoding encoding)
        {
            ProtoContext context = CreateRequest();

            var inputString = "昨日すき焼きを食べました";
            var expected    = encoding.GetBytes(inputString);
            await context.Response.WriteAsync(inputString, encoding);

            context.Response.Body.Position = 0;
            var actual = new byte[expected.Length * 2];
            var length = context.Response.Body.Read(actual);

            var actualShortened = new byte[length];

            Array.Copy(actual, actualShortened, length);

            Assert.Equal(expected.Length, length);
            Assert.Equal(expected, actualShortened);
        }
Ejemplo n.º 6
0
 public Task InvokeAsync(ProtoContext context) => Task.CompletedTask;
Ejemplo n.º 7
0
 public Task Invoke(ProtoContext context, int i) => Task.CompletedTask;
Ejemplo n.º 8
0
 public Task Invoke(ProtoContext context, IServiceProvider provider) => Task.CompletedTask;
Ejemplo n.º 9
0
 public Task Invoke(ProtoContext context, object value) => Task.CompletedTask;
Ejemplo n.º 10
0
 public Task Invoke(ProtoContext context, ref IServiceProvider sp1, out IServiceProvider sp2)
 {
     sp1 = null;
     sp2 = null;
     return(Task.FromResult(0));
 }