In Spring 5.3, multipartData()
methods were added to org.springframework.test.web.client.match.ContentRequestMatchers
, which are useful for testing a multipart request body.
As a slight limitation, to use this method with Spring 5.3, we need to add dependency on Commons-Fileupload in test scope.
The dependency was removed from Spring 6.0 in conjunction with #27423.
It would great if this change to ContentRequestMatchers
would be backported to Spring 5.3.x.
Comment From: sbrannen
In any case, the Javadoc for org.springframework.test.web.client.match.ContentRequestMatchers.multipartData(MultiValueMap<String, ?>)
needs to be updated to point out that it requires FileUpload
support from tomcat-embed-core
instead of from Commons FileUpload.
Comment From: jhoeller
That revision in 6.0 was not really about removing the dependency, rather about replacing it with the Commons FileUpload fork in Tomcat core. We are not going to backport that, we'd rather keep the original Commons FileUpload dependency in 5.3.x, otherwise we would force existing 5.3.x test setups to change their dependency declaration.
@sbrannen I'll take of updating the javadoc accordingly, good catch!
Comment From: wkwkhautbois
Oh, I misunderstood the meaning of that merge request. Now I see, thank you for your explanation.
Comment From: nightswimmings
@jhoeller Just a little note, but as of today, the Javadoc is still not updated "Note: This method uses the Apache Commons FileUpload library to parse the multipart data and it must be on the test classpath."
Comment From: sdeleuze
I have created #31988 related issue (and will backport it to 6.0.x).