You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
There are cases when I would like to not treat / as a sub-routing symbol.
This can be useful for instance in OData functions. Those functions are parts of request path, not a query and hence will not be url-encoded by an http client:
The slash in this expression will not allow me to use routef with /Calculate(%s), since / is a sub-routing separator, so it'll just split my function into 2 pieces.
Describe the solution you'd like
An extra sub route helper, which works similar to routef but uses Regex:
/// **Description**////// Filters an incoming HTTP request based on the request path using Regex (case sensitive).////// If the route matches the incoming HTTP request then the Regex groups will be passed into the supplied `routeHandler`./// This is similar to routex but also allows to use matched strings as parameters for a controller./// /// **Parameters**////// `path`: Regex path./// `routeHandler`: A function which accepts a seq<string> of the matched groups and returns a `HttpHandler` function which will subsequently deal with the request.//////letroutexp(path :string)(routeHandler :seq<string>->HttpHandler):HttpHandler =letpattern= sprintf "^%s$" path
letregex= Regex(pattern, RegexOptions.Compiled)fun(next: HttpFunc)(ctx: Microsoft.AspNetCore.Http.HttpContext)->letresult= regex.Match (SubRouting.getNextPartOfPath ctx)match result.Success with|true->letargs= result.Groups |> Seq.map (fun x -> x.Value)
routeHandler args next ctx
|false-> skipPipeline
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
There are cases when I would like to not treat
/
as a sub-routing symbol.This can be useful for instance in OData functions. Those functions are parts of request path, not a query and hence will not be url-encoded by an http client:
The slash in this expression will not allow me to use
routef
with/Calculate(%s)
, since/
is a sub-routing separator, so it'll just split my function into 2 pieces.Describe the solution you'd like
An extra sub route helper, which works similar to
routef
but uses Regex:The text was updated successfully, but these errors were encountered: