azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

OpenApiHttpRequestDataExtensions.Headers should specify OrdinalIgnoreCase instead of relying on default case sensitive comparer

Open collinstevens opened this issue 2 years ago • 0 comments

Describe the issue OpenApiHttpRequestDataExtensions.Headers() currently returns a dictionary of headers which is case sensitive.

https://github.com/Azure/azure-functions-openapi-extension/blob/da22fa299423e639166c72ae5932f731186e830b/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Extensions/OpenApiHttpRequestDataExtensions.cs#L33

To Reproduce Steps to reproduce the behavior:

  1. Create a HttpRequestData object with a header.
  2. Call Headers() from OpenApiHttpRequestDataExtensions
  3. Call ContainsKey(string) with a different casing of the header you added previously on the IHeadersDictionary returned from Headers()
  4. See false.

Expected behavior OpenApiHttpRequestDataExtensions.Headers() should return a dictionary of headers with the OrdinalIgnoreCase comparer similar to how https://learn.microsoft.com/en-us/dotnet/api/system.net.http.headers.httpheaders.contains?view=net-7.0#system-net-http-headers-httpheaders-contains(system-string) works.

collinstevens avatar Mar 01 '23 21:03 collinstevens