Closed Reedyuk closed 7 years ago
Hi
OHHTTPStubs doesn't contain any URL templating logic. Only simple matchers like isScheme(…)
, isHost(…)
, isPath(…)
and similar are provided.
Instead you can provide your own matcher quite easily, for example use:
stub(condition: { req in
guard let path = req.url?.path else { return false }
return path.hasPrefix("/hello/") && path.hasSuffix("/anotherMethod")
}, response: …)
For advanced matching stuff like using a wildcard *
or similar, you could use https://github.com/Kyle/URITemplate.swift for example.
See also #125.
I'll close this issue as a duplicate of #125, please continue any discussion there.
Hi, I cannot seem to find a way to match my urls with a wildcard. For example:
/hello/9ff49154-9a63-460a-b63a-50b74ded4161/anotherMethod
I would usually pass something like:
/hello/*/anotherMethod
To match the method, as this is how the api structure is setup.