According to HttpInputMessage documentation body can never be null, although this is not true when you create mock response using MockRestResponseCreators without body, e.g. withBadRequest() or withSuccess().
Looks like changes should be done in MockHttpInputMessage to set ByteArrayInputStream with empty byte array if passed content is null. As well null check before closing stream in MockClientHttpResponse may be removed.
Affects: 4.3.12
The text was updated successfully, but these errors were encountered:
I don't follow. MockRestResponseCreators creates a DefaultResponseCreator which initializes the body to byte[0]. Then it passes that into MockHttpInputMessage which has an Assert.notNull check on the body passed in.
withStatus(HttpStatus.TOO_MANY_REQUESTS) uses new DefaultResponseCreator(HttpStatus) and DefaultResponseCreator#content stays null. Then in DefaultResponseCreator#createResponse it goes to the branch where this.contentResource is null:
spring-projects-issues commentedJan 11, 2018
Arthur Gavlyukovskiy opened SPR-16367 and commented
According to HttpInputMessage documentation body can never be null, although this is not true when you create mock response using MockRestResponseCreators without body, e.g. withBadRequest() or withSuccess().
Looks like changes should be done in MockHttpInputMessage to set ByteArrayInputStream with empty byte array if passed content is null. As well null check before closing stream in MockClientHttpResponse may be removed.
Affects: 4.3.12
The text was updated successfully, but these errors were encountered: