Return buffered InputStream from RemoteRequest.Buffering
Description
In Logbook's Servlet implementation, RemoteRequest wrapper returns the same object of ServletInputStream when getInputStream() is called. When/If an interceptor reads the request input stream before the request reaches the handler, the stream will be closed. This is reproducible in https://github.com/mutyasaisrikar/logbook-error.
The proposed change is to override the implementation of getInputStream in RemoteRequest.Buffering class, so that it returns a new instance of InputStream with the buffered body array on every call.
I'm also removing the Streaming abstract class that had 2 implementations: Ignoring and Buffering. As now Buffering will have its own implementations, I couldn't find a use for Ignoring, as I assume the InputStream won't be used by Logbook in case of Ignoring, and it can leave the implementation of State that is returning request.getInputStream().
Motivation and Context
#1865
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All commits are signed