While running Spring Contract test on consumer side using stubs. I got following response first for endpoint creation then for request that was sent to it and then for the response.
Both type1 and type2 are enum fields, the other fields are string.
127.0.0.1 - POST /mappings
Connection: [keep-alive]
User-Agent: [Apache-HttpClient/4.5.12 (Java/11.0.5)]
Host: [localhost:11291]
Content-Length: [834]
Content-Type: [text/plain; charset=UTF-8]
{
"id" : "7d0b6496-be88-43c0-891d-bdb8ef8ae033",
"request" : {
"url" : "/testEndpoint",
"method" : "PUT",
"headers" : {
"Content-Type" : {
"matches" : "application/json;charset=UTF-8.*"
}
},
"bodyPatterns" : [ {
"matchesJsonPath" : "$[?(@.['name'] == 'Test')]"
}, {
"matchesJsonPath" : "$[?(@.['type1'] == 'NONE')]"
}, {
"matchesJsonPath" : "$[?(@.['type2'] == 'NONE')]"
}, {
"matchesJsonPath" : "$[?(@.['description'] == null)]"
}, {
"matchesJsonPath" : "$[?(@.['comment1'] == null)]"
}, {
"matchesJsonPath" : "$[?(@.['comment2'] == null)]"
} ]
},
"response" : {
"status" : 201,
"transformers" : [ "response-template" ]
},
"uuid" : "7d0b6496-be88-43c0-891d-bdb8ef8ae033"
}
127.0.0.1 - PUT /testEndpoint
Connection: [keep-alive]
User-Agent: [Apache-HttpClient/4.5.12 (Java/11.0.5)]
Host: [localhost:11291]
Accept-Encoding: [gzip,deflate]
Content-Length: [117]
Content-Type: [application/json; charset=UTF-8]
{"name":"Test","type1":"NONE","type2":"NONE","description":null,"comment1":null,"comment2":null}
The response I got was:
Matched response definition:
(no response definition configured)
Response:
HTTP/1.1 404
(no headers)