diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensions.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensions.kt index 18c05f6e07..9288040607 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensions.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensions.kt @@ -80,11 +80,11 @@ class RouterDsl { operator fun RequestPredicate.not(): RequestPredicate = this.negate() - fun RequestPredicate.route(r: Routes) { + fun RequestPredicate.nest(r: Routes) { routes += RouterFunctions.nest(this, RouterDsl().apply(r).router()) } - fun String.route(r: Routes) { + fun String.nest(r: Routes) { routes += RouterFunctions.nest(pathPrefix(this), RouterDsl().apply(r).router()) } diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt index 5663ade678..443ab616d3 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionExtensionsTests.kt @@ -107,7 +107,7 @@ class RouterFunctionExtensionsTests { fun sampleRouter() = router { (GET("/foo/") or GET("/foos/")) { req -> handle(req) } - "/api".route { + "/api".nest { POST("/foo/", ::handleFromClass) PUT("/foo/", :: handleFromClass) "/foo/" { handleFromClass(it) } @@ -115,7 +115,7 @@ class RouterFunctionExtensionsTests { accept(APPLICATION_ATOM_XML, ::handle) contentType(APPLICATION_OCTET_STREAM, ::handle) method(PATCH, ::handle) - headers({ it.accept().contains(APPLICATION_JSON) }).route { + headers({ it.accept().contains(APPLICATION_JSON) }).nest { GET("/api/foo/", ::handle) } headers({ it.header("bar").isNotEmpty() }, ::handle)