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
In some cases this link can have multiple path components. The number of path components is not fixed and we do not know how many additional path components are added to this link (0..n).
Is there any way this can be done. We tried multiple combinations with Skip, Many and Rest but the problem seems to be that the Path component passes one element to the Parser at a time.
The workaround for us would be to implement a custom Path parser which does not pass the path components one by one but the whole path at once. So we can work with the Prefix Parser.
We'd like to know if there is a better way with the given component?
Thank you for having a look at this. 👍
Following a code example to represent the problem.
import Foundation
import URLRouting
enum AppRoute {
case colors
}
let appRouter = OneOf {
Route(.case(AppRoute.colors)) {
Scheme("https")
Host("example.de")
Path {
"colors"
}
}
}
let testURL = URL(string: "https://example.de/colors")!
let testURL2 = URL(string: "https://example.de/colors/foo")!
try appRouter.match(url: testURL) // matches AppRoute.colors
try appRouter.match(url: testURL2) // fails with expected end of input`
The text was updated successfully, but these errors were encountered:
Hello everyone 👋
We are currently using URLRouting in our Application.
In our current case we've been facing a problem with the parsing of the path of an URL.
Use case:
The link which will be parsed looks like this:
https://example.de/colors
In some cases this link can have multiple path components. The number of path components is not fixed and we do not know how many additional path components are added to this link (0..n).
Is there any way this can be done. We tried multiple combinations with Skip, Many and Rest but the problem seems to be that the Path component passes one element to the Parser at a time.
The workaround for us would be to implement a custom Path parser which does not pass the path components one by one but the whole path at once. So we can work with the Prefix Parser.
We'd like to know if there is a better way with the given component?
Thank you for having a look at this. 👍
Following a code example to represent the problem.
The text was updated successfully, but these errors were encountered: