Merge branch 'master' into 2.0.x

This commit is contained in:
Marcin Grzejszczak
2017-07-13 12:22:21 +02:00
2 changed files with 44 additions and 0 deletions

View File

@@ -36,6 +36,11 @@ class Header extends DslProperty {
this.name = name
}
Header(String name, MatchingStrategy value) {
super(value)
this.name = name
}
Header(String name, Object value) {
super(value)
this.name = name

View File

@@ -762,6 +762,45 @@ class WireMockGroovyDslSpec extends Specification implements WireMockStubVerifie
stubMappingIsValidWireMockStub(json)
}
@Issue("#353")
def "should generate request with absent header for client side"() {
given:
org.springframework.cloud.contract.spec.Contract groovyDsl = org.springframework.cloud.contract.spec.Contract.make {
request {
method 'GET'
urlPath( '/some/path/*')
headers {
header('''Authentication''', absent())
}
}
response {
status 200
}
}
when:
def json = toWireMockClientJsonStub(groovyDsl)
then:
AssertionUtil.assertThatJsonsAreEqual(('''
{
"request" : {
"urlPath" : "/some/path/*",
"method" : "GET",
"headers" : {
"Authentication" : {
"absent" : true
}
}
},
"response" : {
"status" : 200,
"transformers" : [ "response-template" ]
}
}
'''), json)
and:
stubMappingIsValidWireMockStub(json)
}
@Issue('#230')
def "should generate request with urlPathPattern and queryParameters for client side\
when both contains regular expressions"() {