Add request headers validation

This commit is contained in:
Dominik Adam Przybysz 2014-12-12 19:16:09 +01:00
parent 9670cd6d7e
commit c97ce11837
6 changed files with 48 additions and 5 deletions

View file

@ -28,7 +28,10 @@ class ContextExecutor {
continue
}
}
if (ex.requestMethod == mock.method && mock.predicate(xml)) {
Map<String,String> headers = ex.requestHeaders.collectEntries { [it.key.toLowerCase(), it.value.join(',')] }
if (ex.requestMethod == mock.method &&
mock.predicate(xml) &&
mock.requestHeaders(headers)) {
println "Mock ${mock.name} invoked"
++mock.counter
String response = mock.responseOk(xml)