Path variables must be declared in the route path before access. Attempt to access an undeclared path variable will result in a runtime error.
Example:
@Configuration
class RouterConfiguration {
@Bean
fun myRouter() = router {
GET("/test/{var}") { ServerResponse.ok().body("${it.pathVariable("bar")}") }
}
}
After the fix is applied:
@Configuration
class RouterConfiguration {
@Bean
fun myRouter() = router {
GET("/test/{var}") { ServerResponse.ok().body("${it.pathVariable("var")}") }
}
}