Added a new RouteFileCache and more response extensions. Bumped package version to 1.3.4.

This commit is contained in:
2023-03-01 16:19:20 -08:00
parent 662bd03ddc
commit 2b892dfd66
4 changed files with 247 additions and 2 deletions

View File

@ -28,6 +28,8 @@ namespace MontoyaTech.Rest.Net.Example
}
}
public static RouteFileCache FileCache = new RouteFileCache(100 * 1024 * 1024);
public static void Main(string[] args)
{
File.WriteAllText("test.txt", "hello from a file");
@ -98,7 +100,9 @@ namespace MontoyaTech.Rest.Net.Example
[RouteResponse(typeof(string))]
public static HttpListenerResponse CompressFile(HttpListenerContext context)
{
return context.Response.WithStatus(HttpStatusCode.OK).WithCompressedFile("test.txt");
var content = FileCache.Cache("test.txt");
return context.Response.WithStatus(HttpStatusCode.OK).WithCompressedFile("test.txt", content);
}
[RouteGroup("Test")]