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("")); }
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); }