Open
Description
Description
While creating a custom LoggingMiddleware
, we encountered an issue where parameters without a value are not included in the IOwinRequest.Query
dictionary. Our use case requires logging all parameters passed to our service, but parameters with no associated value and no "=" sign (e.g., ?param
) are omitted from the query dictionary.
To resolve this, we had to manually parse the QueryString
. This behavior is not explicitly documented, and it was unexpected.
Proposed Fix
I believe the issue lies in the ParseDelimited()
method in src/Microsoft.Owin/Infrastructure/OwinHelpers.cs
. The following check:
if (equalIndex < delimiterIndex)
ignores the possibility of parsing parameters without a corresponding value.
Steps to Reproduce
- Create a middleware that inspects the
IOwinRequest.Query
dictionary. - Send a request with a query string containing parameters without values and without "=" sign (e.g.,
?param1=1¶m2
). - Notice that
param2
is missing from theQuery
dictionary.
Metadata
Metadata
Assignees
Labels
No labels