Merge branch '1.1.x'

This commit is contained in:
Marcin Grzejszczak
2017-11-13 10:16:36 +01:00
2 changed files with 5 additions and 2 deletions

View File

@@ -73,9 +73,10 @@ public class ContractDslSnippet extends TemplatedSnippet {
model.put("response_status", response.getStatus().value());
model.put("response_body_present", response.getContent().length > 0);
model.put("response_body", response.getContentAsString());
HttpHeaders headers = response.getHeaders();
Map<String, String> headers = response.getHeaders().toSingleValueMap();
filterHeaders(headers);
model.put("response_headers_present", !headers.isEmpty());
model.put("response_headers", headers.toSingleValueMap().entrySet());
model.put("response_headers", headers.entrySet());
@SuppressWarnings("unchecked") Set<String> jsonPaths = (Set<String>) operation.getAttributes()
.get("contract.jsonPaths");
model.put("response_json_paths_present", jsonPaths != null && !jsonPaths.isEmpty());

View File

@@ -84,6 +84,8 @@ public class ContractDslSnippetTests {
then(parsedContract.getRequest().getHeaders().getEntries()).isNotNull();
then(headerNames(parsedContract.getRequest().getHeaders().getEntries())).doesNotContain
(HttpHeaders.HOST, HttpHeaders.CONTENT_LENGTH);
then(headerNames(parsedContract.getResponse().getHeaders().getEntries())).doesNotContain
(HttpHeaders.HOST, HttpHeaders.CONTENT_LENGTH);
then(parsedContract.getRequest().getMethod().getClientValue()).isNotNull();
then(parsedContract.getRequest().getUrl().getClientValue()).isNotNull();
then(parsedContract.getRequest().getUrl().getClientValue().toString()).startsWith("/");