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.
The text was updated successfully, but these errors were encountered:
I don't follow. MockRestResponseCreators creates a DefaultResponseCreator which initializes the body to byte. 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: