Closed
Description
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:
- MockHttpServletRequest.getReader, getInputStream should each return the same object on repeat calls [SPR-16505] #21048 MockHttpServletRequest.getReader, getInputStream should each return the same object on repeat calls