Skip to content

MockHttpServletRequest shouldn't allow calls to both getReader and getInputStream [SPR-16499] #21042

Closed
@spring-projects-issues

Description

@spring-projects-issues

Av Pinzur opened SPR-16499 and commented

Per the ServletRequest documentation, ServletRequest's two methods for reading the request body - getReader and getInputStream - cannot be used in combination. Implementations are supposed to throw IllegalStateException from either method if the other has already been called.

Revising MockHttpServletRequest to conform to this documented behavior will reinforce the value of Spring Test by allowing users to catch subtle bugs during unit/integration testing, rather than discovering non-compliant usage patterns only when running in an actual container.


Affects: 4.3.14, 5.0.3

Issue Links:

Referenced from: pull request #1688, and commits 3fc8ec4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions