Does someone knows if it's possible to write a DSL...
# spring
l
Does someone knows if it's possible to write a DSL to configure the URI of a
WebTestClient
instance? For example, instead of writing
Copy code
client.get()
        .uri {
            it.path("/get")
                    .queryParam("name", "John Smith")
                    .queryParam("age", 45)
                    .queryParam("isCanadian", true)
                    .build()
        }
        .exchange()
        .expectStatus().isOk
        .expectBody()
        .jsonPath("$.person").exists()
Write something like
Copy code
client.get()
        .uri("/get") {
            +queryParam("name" to "John Smith")
            +queryParam("age" to 45)
            +queryParam("isCanadian" to true)
        }
        .exchange()
        .expectStatus().isOk
        .expectBody()
        .jsonPath("$.person").exists()
t
kotlin has operator overload. you can define that API
l
Thanks, @tmg. I'll look at the concept you've mentioned. I just thought it was already implemented since Spring Webflux has some extensions to Kotlin.