From b21747c63bd7b57a5f70c5e651b4d00ee17da94d Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 18 Mar 2026 10:46:34 +0800 Subject: [PATCH] Dispose HttpRequestMessage in tests --- .../Mvc/Validation/FluentValidationTestAppService_Tests.cs | 2 +- .../AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/FluentValidationTestAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/FluentValidationTestAppService_Tests.cs index 563c68a039..24360b1254 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/FluentValidationTestAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/FluentValidationTestAppService_Tests.cs @@ -53,7 +53,7 @@ public class FluentValidationTestAppService_Tests : AspNetCoreMvcTestBase private async Task PostAsync(string jsonContent) { - var request = new HttpRequestMessage(HttpMethod.Post, "/api/app/fluent-validation-test") + using var request = new HttpRequestMessage(HttpMethod.Post, "/api/app/fluent-validation-test") { Content = new StringContent(jsonContent, Encoding.UTF8, "application/json") }; diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs index a0d0040cc9..651a2650dc 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs @@ -121,7 +121,7 @@ public class ValidationTestController_Tests : AspNetCoreMvcTestBase // FluentValidationTestInput has a FluentValidator with MinimumLength(3) rule, // but this is a regular AbpController (not IValidationEnabled), // so FluentValidation should NOT be triggered. - var request = new HttpRequestMessage(HttpMethod.Post, "/api/validation-test/fluent-validation-action") + using var request = new HttpRequestMessage(HttpMethod.Post, "/api/validation-test/fluent-validation-action") { Content = new StringContent("{\"name\": \"A\"}", Encoding.UTF8, "application/json") };