Beispiel #1
0
        public async Task GetMock(HttpContext context)
        {
            string[]  paths = context.Request.Path.Value.Split('/');
            Guid      guid  = Guid.Parse(paths[2]);
            MockModel mock  = await _mockService.GetMock(guid, context.Request.Method);

            (await mock.IsNotNullAsync(async() =>
            {
                context.Request.HasQueryValues((query) =>
                {
                    mock.ResolveDynamicBody(query);
                });

                await context.Response.WriteMock(mock);
            }))
            .IsNull(() =>
            {
                context.Response.StatusCode = 404;
            });
        }