diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-08-14 19:45:52 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-08-14 19:45:52 +0200 |
commit | 8253ca8cb96154f95854b1c1e5dd3ba53f41e5ec (patch) | |
tree | 34976d3e005f91ba479ce8286a9ffa6ac9651237 /MxApiExtensions/Program.cs | |
parent | Initial commit (diff) | |
download | MxApiExtensions-8253ca8cb96154f95854b1c1e5dd3ba53f41e5ec.tar.xz |
Code cleanup
Diffstat (limited to '')
-rw-r--r-- | MxApiExtensions/Program.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/MxApiExtensions/Program.cs b/MxApiExtensions/Program.cs index 00afe09..11fe114 100644 --- a/MxApiExtensions/Program.cs +++ b/MxApiExtensions/Program.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Http.Timeouts; using MxApiExtensions; var builder = WebApplication.CreateBuilder(args); @@ -15,13 +16,13 @@ builder.Services.AddSingleton<CacheConfiguration>(); builder.Services.AddScoped<Auth>(); builder.Services.AddRequestTimeouts(x => { - x.DefaultPolicy = new() { + x.DefaultPolicy = new RequestTimeoutPolicy { Timeout = TimeSpan.FromMinutes(10), WriteTimeoutResponse = async context => { context.Response.StatusCode = 504; context.Response.ContentType = "application/json"; await context.Response.StartAsync(); - await context.Response.WriteAsJsonAsync(new MatrixException() { + await context.Response.WriteAsJsonAsync(new MatrixException { ErrorCode = "M_TIMEOUT", Error = "Request timed out" }.GetAsJson()); |