Skip to content

Commit

Permalink
Merge pull request #127 from sheridanchris/multi-verb-routing-fix
Browse files Browse the repository at this point in the history
Multi-verb routing fix
  • Loading branch information
pimbrouwers authored Sep 27, 2024
2 parents ed33b8f + 4656b94 commit e58d1a8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Falco/Routing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,21 @@ type internal FalcoEndpointDatasource(httpEndpoints : HttpEndpoint seq) =
if strEmpty verbStr then endpoint.Pattern
else strConcat [|verbStr; " "; endpoint.Pattern|]

let requestDelegate = HttpHandler.toRequestDelegate handler
let httpMethodMetadata =
match verb with
| ANY -> HttpMethodMetadata [||]
| _ -> HttpMethodMetadata [|verbStr|]

let routeNameMetadata = RouteNameMetadata(endpoint.Pattern)
let metadataCollection = EndpointMetadataCollection(routeNameMetadata, httpMethodMetadata)

let requestDelegate = HttpHandler.toRequestDelegate handler

let endpointBuilder = RouteEndpointBuilder(requestDelegate, routePattern, order, DisplayName = displayName)
endpointBuilder.DisplayName <- displayName

for metadata in metadataCollection do
endpointBuilder.Metadata.Add(metadata)

for convention in conventions do
convention.Invoke(endpointBuilder)
Expand Down

0 comments on commit e58d1a8

Please sign in to comment.