| | | 1 | | using System.Text.Json; |
| | | 2 | | using Estud.Mocks.Providers; |
| | | 3 | | using System.Text.Json.Serialization; |
| | | 4 | | |
| | | 5 | | namespace Estud.Mocks.Configs; |
| | | 6 | | |
| | | 7 | | public static class HttpConfigs |
| | | 8 | | { |
| | | 9 | | public static void AddHttpConfigs(this WebApplicationBuilder builder) |
| | | 10 | | { |
| | 2 | 11 | | builder.Services.AddControllers() |
| | 2 | 12 | | .ConfigureApplicationPartManager(apm => |
| | 4 | 13 | | apm.FeatureProviders.Add( |
| | 4 | 14 | | new RegisterOnlyMocksControllersFeatureProvider())); |
| | | 15 | | |
| | 2 | 16 | | builder.Services.AddControllers() |
| | 2 | 17 | | .AddJsonOptions(options => |
| | 2 | 18 | | { |
| | 2 | 19 | | options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); |
| | 2 | 20 | | options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; |
| | 4 | 21 | | }); |
| | | 22 | | |
| | 4 | 23 | | builder.Services.AddRouting(options => options.LowercaseUrls = true); |
| | 2 | 24 | | } |
| | | 25 | | |
| | | 26 | | public static void UseControllers(this IApplicationBuilder app) |
| | | 27 | | { |
| | 2 | 28 | | app.UseEndpoints(options => |
| | 2 | 29 | | { |
| | 2 | 30 | | options.MapControllers(); |
| | 4 | 31 | | }); |
| | 2 | 32 | | } |
| | | 33 | | } |