Validation fails for empty responses

Issue #138 resolved
Former user created an issue

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)

  1. Log in to comment