Skip to content
Merged

Dev #38

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>

<Version>1.3.4</Version>
<Version>1.3.5</Version>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/ServiceEndpointClient/ServiceEndpointClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.6" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.7" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/ShowcaseWebApi/ShowcaseWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.3" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
Expand Down
4 changes: 2 additions & 2 deletions samples/WeatherForecastWebApi/WeatherForecastWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.6" />
<PackageReference Include="Scalar.AspNetCore" Version="2.4.13" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.7" />
<PackageReference Include="Scalar.AspNetCore" Version="2.6.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.6" />
<PackageReference Include="ModResults" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.7" />
<PackageReference Include="ModResults" Version="1.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ModEndpoints/ModEndpoints.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ModResults.MinimalApis" Version="1.0.1" />
<PackageReference Include="ModResults.MinimalApis" Version="1.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@ public class DefaultPreferredSuccessStatusCodeCacheForResult : IPreferredSuccess
var producesList = endpoint
.Metadata
.GetOrderedMetadata<IProducesResponseTypeMetadata>();
if (producesList is null || producesList.Count == 0)
#if NET9_0
// Exclude IResult responses with application/json content type for StatusCodes.Status200OK
// .NET 9.0 adds it by default, so we filter it out while determining preferred status code
// see https://github.com/dotnet/aspnetcore/issues/57801
producesList = producesList.Where(p =>
(p.StatusCode == StatusCodes.Status200OK &&
p.ContentTypes.Count() == 1 &&
p.ContentTypes.First() == "application/json" &&
p.Type == typeof(IResult)) == false)
.ToList()
.AsReadOnly();
#endif
if (producesList.Count == 0)
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@ public class DefaultPreferredSuccessStatusCodeCacheForResultOfT : IPreferredSucc
var producesList = endpoint
.Metadata
.GetOrderedMetadata<IProducesResponseTypeMetadata>();
if (producesList is null || producesList.Count == 0)
#if NET9_0
// Exclude IResult responses with application/json content type for StatusCodes.Status200OK
// .NET 9.0 adds it by default, so we filter it out while determining preferred status code
// see https://github.com/dotnet/aspnetcore/issues/57801
producesList = producesList.Where(p =>
(p.StatusCode == StatusCodes.Status200OK &&
p.ContentTypes.Count() == 1 &&
p.ContentTypes.First() == "application/json" &&
p.Type == typeof(IResult)) == false)
.ToList()
.AsReadOnly();
#endif
if (producesList.Count == 0)
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
14 changes: 10 additions & 4 deletions tests/ModEndpoints.Tests/ModEndpoints.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -14,17 +14,23 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.17" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.3" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.18" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net9.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.7" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ModEndpoints.TestServer\ModEndpoints.TestServer.csproj" />
</ItemGroup>
Expand Down