aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Add SkipStatusCodePages property to ApiBehaviorOptions

Open aw0lid opened this issue 4 months ago • 1 comments

Add SkipStatusCodePages property to ApiBehaviorOptions

Description

This PR implements the approved API proposal to add the SkipStatusCodePages property to ApiBehaviorOptions.

What was done:

  • API Extension: Added the SkipStatusCodePages boolean property to ApiBehaviorOptions.
  • Application Model Provider: Updated ApiBehaviorApplicationModelProvider to check if SkipStatusCodePages is set to true. When enabled and targeting an API Controller (ApiControllerAttribute), it automatically injects SkipStatusCodePagesMetadata.Instance into the action's route selectors.
  • Public API: Updated PublicAPI.Unshipped.txt to include the new property.

Tests Added:

Added unit tests in ApiBehaviorApplicationModelProviderTest.cs covering the following scenarios:

  • Verifying metadata is added when SkipStatusCodePages = true on an API Controller.
  • Verifying metadata is not added when SkipStatusCodePages = true on a non-API Controller.
  • Verifying metadata is not added by default when SkipStatusCodePages = false.

Fixes #45369

aw0lid avatar Jul 29 '26 21:07 aw0lid

Thanks for your PR, @aw0lid. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

dotnet-policy-service avatar Jul 29 '26 21:07 dotnet-policy-service

Friendly ping Re-requesting review on this PR. All CI checks are green. Could someone from the team take a look when you have a moment? Thanks!

aw0lid avatar Aug 04 '26 11:08 aw0lid

Hi @aw0lid

We'll consider this for .NET 12 once main branch becomes .NET 12 (after .NET 11 RC1 is released).

Youssef1313 avatar Aug 04 '26 11:08 Youssef1313