Are there any constants for the default HTTP headers?

后端 未结 8 830
时光说笑
时光说笑 2021-02-01 00:21

Has Microsoft created a class full of constants for the standard HTTP header names or will I have to write my own?

8条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-01 01:12

    There are some available in the Microsoft.Net.Http.Headers nuget package. In my asp.net core project it was already installed.

    Example usage:

    var value = request.Headers[Microsoft.Net.Http.Headers.HeaderNames.IfNoneMatch]

    Might be what some are looking for?

提交回复
热议问题