copy

fun copy(path: String = this.path, queryParams: Map<String, String> = this.queryParams, fragment: String? = this.fragment): Route(source)

Make a copy of this Route, optionally changing one or more of its components.

For example, route.copy("newpath") will create a route with a new path but keeping the same query parameters and fragments as before, if any were present.