azure-functions-openapi-extension
azure-functions-openapi-extension copied to clipboard
OpenApiHttpRequestDataExtensions.Headers should specify OrdinalIgnoreCase instead of relying on default case sensitive comparer
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:
- Create a HttpRequestData object with a header.
- Call Headers() from OpenApiHttpRequestDataExtensions
- Call ContainsKey(string) with a different casing of the header you added previously on the IHeadersDictionary returned from Headers()
- 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.