Validation fails for empty responses
RestAssuredResponse adds all the headers to the response and then checks contentType specifically.
if (originalResponse.getHeaders() != null) { originalResponse.getHeaders().forEach(header -> builder.withHeader(header.getName(), header.getValue())); } if (originalResponse.getContentType() != null) { builder.withContentType(originalResponse.getContentType()); }
The problem is that originalResponse.getContentType() will never return null as RestAssured defaults it to an empty String when the service does not set it. This causes the validation to fail on any empty response as the Validator will report that empty String is not a valid value for ContentType.
Comments (3)
-
-
- changed status to resolved
Fix issue 138 where validation fails for empty responses.
→ <<cset 35426cdfecf2>>
-
Merged in chapmbk/swagger-request-validator/issue-138 (pull request #97)
Fix issue 138 where validation fails for empty responses.
Approved-by: Brandon Chapman chapmbk@gmail.com Approved-by: James Navin jnavin@atlassian.com
→ <<cset fc95533343ea>>
- Log in to comment
Issue is fixed with this PR. https://bitbucket.org/atlassian/swagger-request-validator/pull-requests/97