Skip to content

MockClientHttpResponse should not return null body [SPR-16367] #20914

@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: testIssues in the test moduletype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions