:scroll: Description
- Spring provides a ContentCachingRequestWrapper that caches the body.
- ~Support other Content-types, including JSON.~
:bulb: Motivation and Context
- The goal of this PR is to fix Request#getParameter not returning a result if the POST request is
application/x-www-form-urlencoded.
- In
Request in embed-Tomcat, if the InputStream is read first(body cached), the parameter will not be parsed.
// class org.apache.catalina.connector.Request
@Override
public ServletInputStream getInputStream() throws IOException {
if (usingReader) {
throw new IllegalStateException(sm.getString("coyoteRequest.getInputStream.ise"));
}
usingInputStream = true;
if (inputStream == null) {
inputStream = new CoyoteInputStream(inputBuffer);
}
return inputStream;
}
...
protected void parseParameters() {
...
if (usingInputStream || usingReader) {
success = true;
return;
}
...
:green_heart: How did you test it?
:pencil: Checklist
- [X] I reviewed the submitted code.
- [X] I added tests to verify the changes.
- [ ] No new PII added or SDK only sends newly added PII if
sendDefaultPII is enabled.
- [ ] I updated the docs if needed.
- [ ] Review from the native team if needed.
- [ ] No breaking change or entry added to the changelog.
- [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs.
:crystal_ball: Next steps