-
Notifications
You must be signed in to change notification settings - Fork 38.5k
PartEvent upload fails with JdkClientHttpConnector #29400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for checking out this new API! There are a couple of things causing the failure.
in your code, you're only handling the first event, not any subsequent ones. At the very least, you have to dispose the contents of the following events, otherwise you'll end up with stale connections. So do something like: return partEvents.map(PartEvent::content)
.map(DataBufferUtils::release)
.then(Mono.just(filename));
|
@poutsma My example is copied from the Spring official doc, check PartEvent.
The Finally uses a |
Indeed. You might want to check the author of said documentation (and the In the PartEvent Javadoc it says:
In your sample, you handling not handling the body content. The code snippet I gave above fixes that by releasing it. |
Add note about the necessity of consuming the PartEvent content. See gh-29400
OK, updated my example.
The IntegrationTests still failed with messages like. https://github.com/hantsy/spring6-sandbox/actions/runs/3371019674/jobs/5592675195#step:4:10358 Decoded "["test","spring.png"]"
Error: Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.685 s <<< FAILURE! - in com.example.demo.IntegrationTests
Error: com.example.demo.IntegrationTests.testPartEvents Time elapsed: 0.501 s <<< FAILURE!
java.lang.AssertionError: expectation "expectNextCount(2)" failed (expected: count = 2; actual: counted = 1; signal: onComplete()) |
That failure is because the response is encoded as a JSON list. Spring MVC picked JSON as the response type, because the return type of |
Uh oh!
There was an error while loading. Please reload this page.
Affects: Spring 6.0.0-RC2
I tried to taste the new PartEvent feature in Spring 6, and created an example project.
There is a
/partevents
inFileUploadController
to use the newest PartEvent handling uploading form.I tried to return the field value of
name
and filename offile
in the Http response.And I have created an integration test using
WebClient
to verify it, but test failed.The complete error stack can be found here, https://github.com/hantsy/spring6-sandbox/actions/runs/3350695924/jobs/5551671488#step:4:9421
But the controller unit test using WebTestClient is got passed. I've tried to use
curl
to send request to the running application, it was working as expected.The text was updated successfully, but these errors were encountered: