Example #1
0
        public ApiMockerResult Resolve(string url)
        {
            var    urlparsed = url.Replace("/", "");
            string content   = "";
            bool   isfound   = _dataset.TryGetValue(urlparsed, out content);

            return((isfound)?  ApiMockerResult.JsonOk(content): ApiMockerResult.JsonNotFound(""));
        }
Example #2
0
 private async Task WriteResultInResponse(HttpContext httpContext, ApiMockerResult result)
 {
     httpContext.Response.StatusCode  = result.StatusCode;
     httpContext.Response.ContentType = result.ContentType;
     await HttpResponseWritingExtensions.WriteAsync(httpContext.Response, result.Content);
 }