Class QueryParsingConfig
Configures how query-binding middleware parses query strings.
Implements
Inherited Members
Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public sealed record QueryParsingConfig : IEquatable<QueryParsingConfig>
Remarks
Query-binding middleware snapshots the configuration that is current when it is registered.
Examples
builder.ConfigureQueryParsing(config => config with
{
UnexpectedParameterBehavior = UnexpectedParameterBehavior.Reject
});
Constructors
QueryParsingConfig()
Declaration
public QueryParsingConfig()
Properties
Default
Gets the default query-parsing configuration.
Declaration
public static QueryParsingConfig Default { get; }
Property Value
| Type | Description |
|---|---|
| QueryParsingConfig |
Examples
QueryParsingConfig config = QueryParsingConfig.Default;
UnexpectedParameterBehavior
Gets how undeclared query-string parameters are handled.
Declaration
public UnexpectedParameterBehavior UnexpectedParameterBehavior { get; init; }
Property Value
| Type | Description |
|---|---|
| UnexpectedParameterBehavior |
Remarks
The default is Ignore, so additional query-string keys that are not present in the binding descriptor do not affect request processing.
Examples
builder.ConfigureQueryParsing(config => config with
{
UnexpectedParameterBehavior = UnexpectedParameterBehavior.Reject
});
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when the assigned value is not a defined UnexpectedParameterBehavior value. |