public HttpResponseMessage Get(string fileName, string format) { logger.Info("The request came. Method: '{0}', Request path: '{1}', File name: '{2}', File format: '{3}'", Request.Method, Request.RequestUri.AbsolutePath, fileName, format); var path = GetRepoPath(fileName, format); try { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StreamContent(logic.GetStream(path)); response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment"); response.Content.Headers.ContentDisposition.FileName = fileName + "." + format; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/" + format); return(response); } catch (Exception e) { logger.Error(e.Message); return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, e.Message)); } }