
com.confluex.mule.test.http.matchers.HttpMatchers.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of confluex-mock-http Show documentation
Show all versions of confluex-mock-http Show documentation
Testing library for mocking interactions to external HTTP servers
package com.confluex.mule.test.http.matchers
import com.confluex.mule.test.http.ClientRequest
class HttpMatchers {
static HttpRequestMatcher anyRequest() {
new HttpRequestMatcher({
return true // matches everything
})
}
static HttpRequestMatcher path(String path) {
new HttpRequestMatcher({ ClientRequest request ->
return path == request.path
})
}
static HttpRequestMatcher body(String body) {
new HttpRequestMatcher({ ClientRequest request ->
return body == request.body
})
}
static HttpRequestMatcher queryParam(String key) {
new HttpRequestMatcher({ ClientRequest request ->
return request.queryParams.containsKey(key)
})
}
static HttpRequestMatcher queryParam(String key, String value) {
new HttpRequestMatcher({ ClientRequest request ->
return request.queryParams[key] == value
})
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy