oas icon indicating copy to clipboard operation
oas copied to clipboard

findOperationMatches fails on default server `/`

Open joeppeeters opened this issue 1 year ago • 2 comments

I'm trying to match an incoming request to an operation based on its request path.

Matching appears to be fine as long as there is a server definition. However, in case of an OAS without a server specification (which defaults to / according to the spec) the matching appears to be failing.

"servers" : [{"url" : "/api"}],
 api.findOperationMatches("http://localhost:3000/api/user/john", "get")
 #=> { operation }

but,

"servers": [{"url":"/"}],
 api.findOperationMatches("http://localhost:3000/user/john", "get")
 #=> undefined

I think both situations should succeed. Is this a bug?

joeppeeters avatar Nov 21 '23 07:11 joeppeeters