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