Skip to content

Commit

Permalink
Add new namespaces and improve RewriteOptions readability
Browse files Browse the repository at this point in the history
Added several `using` directives in `Program.cs` for new functionalities and dependencies. Modified `RewriteOptions` configuration to use `HttpStatusCode.MovedPermanently` instead of a hardcoded integer for better readability and maintainability.
  • Loading branch information
EdiWang committed Oct 7, 2024
1 parent 27b5481 commit 49ebb27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Moonglade.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using System.Net;
using System.Text.Json.Serialization;
using Edi.Captcha;
using Edi.PasswordGenerator;
Expand Down Expand Up @@ -286,7 +287,7 @@ private static void ConfigureMiddleware(WebApplication app, List<CultureInfo> cu
SupportedUICultures = cultures
});

var options = new RewriteOptions().AddRedirect(@"(.*)/$", @"\$1", 301);
var options = new RewriteOptions().AddRedirect(@"(.*)/$", @"\$1", (int)HttpStatusCode.MovedPermanently);
app.UseRewriter(options);
app.UseStaticFiles();
app.UseSession().UseCaptchaImage(p =>
Expand Down

0 comments on commit 49ebb27

Please sign in to comment.