Skip to content

HeaderNames now contains static readonly fields instead of const fields #356

Open
@halter73

Description

@halter73

The static Microsoft.Net.Http.Headers.HeaderNames class contains string fields representing various common header names (e.g. HeaderNames.Origin). Starting in ASP.NET Core 3.0 Preview 5, these will change from const fields to static readonly fields.

While this is not a binary breaking change, source code that used these fields as an argument attribute, a case in a switch statement, or when defining another constant will no longer be able to do so. To work around this break, developers can switch to using self-defined header name constants or string literals.

See dotnet/aspnetcore#9514 for discussion.

[This announcement has been migrated to: dotnet/docs#14901]

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0.0Announcements related to ASP.NET Core 3.0AnnouncementBreaking changeDocumentedThe breaking change has been published to the .NET Core docsMigrated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions