Skip to content

Commit

Permalink
Add query parameters to MockMvc Kotlin DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
corby kim authored and sdeleuze committed Mar 5, 2024
1 parent 4300fec commit 132fbe2
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ open class MockHttpServletRequestDsl internal constructor (private val builder:
*/
var params: MultiValueMap<String, String>? = null

/**
* @see [MockHttpServletRequestBuilder.queryParam]
*/
fun queryParam(name: String, vararg values: String) {
builder.queryParam(name, *values)
}

/**
* @see [MockHttpServletRequestBuilder.queryParams]
*/
var queryParams: MultiValueMap<String, String>? = null

/**
* @see [MockHttpServletRequestBuilder.cookie]
*/
Expand Down Expand Up @@ -200,6 +212,7 @@ open class MockHttpServletRequestDsl internal constructor (private val builder:
accept?.also { builder.accept(it) }
contentType?.also { builder.contentType(it) }
params?.also { builder.params(it) }
queryParams?.also { builder.queryParams(it) }
sessionAttrs?.also { builder.sessionAttrs(it) }
flashAttrs?.also { builder.flashAttrs(it) }
session?.also { builder.session(it) }
Expand Down

0 comments on commit 132fbe2

Please sign in to comment.