Beispiel #1
0
        private void RespondWithIndexHtml(HttpResponseMessage response)
        {
            response.StatusCode = HttpStatusCode.OK;

            using (var stream = _options.IndexStream())
            {
                var htmlBuilder = new StringBuilder(new StreamReader(stream).ReadToEnd());
                foreach (var entry in GetIndexArguments())
                {
                    htmlBuilder.Replace(entry.Key, entry.Value);
                }

                response.Content = new StringContent(htmlBuilder.ToString(), Encoding.UTF8);
                response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
            }
        }