You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading Spring Boot to 2.4.0 my tests started to fail:
Request parts with the following names were not found in the request: [data, media]
org.springframework.restdocs.snippet.SnippetException: Request parts with the following names were not found in the request: [data, media]
at org.springframework.restdocs.request.RequestPartsSnippet.verificationFailed(RequestPartsSnippet.java:189)
at org.springframework.restdocs.request.RequestPartsSnippet.verifyRequestPartDescriptors(RequestPartsSnippet.java:165)
Reason is this code in org.springframework.restdocs.webtestclient.WebTestClientRequestConverter:
private List<OperationRequestPart> extractRequestParts(ExchangeResult result) {
if (!ClassUtils.isPresent("org.synchronoss.cloud.nio.multipart.NioMultipartParserListener",
getClass().getClassLoader())) {
return Collections.emptyList();
}
return new MultipartHttpMessageReader(new SynchronossPartHttpMessageReader())
.readMono(ResolvableType.forClass(Part.class), new ExchangeResultReactiveHttpInputMessage(result),
Collections.emptyMap())
.onErrorReturn(new LinkedMultiValueMap<>()).block().values().stream()
.flatMap((parts) -> parts.stream().map(this::createOperationRequestPart)).collect(Collectors.toList());
}
Spring Boot 2.4.0 does not depend on org.synchronoss.cloud:nio-multipart-parser anymore, so method always returns empty list.
As a workaround this dependency should be added explicitly to the project:
Thanks for the report. We have compatibility tests for Spring Framework 5.3 but they didn't catch this as the tests always have nio-multipart-parser on the classpath. We'll need to make use of Framework 5.3's built-in parser when it's available.
wilkinsona
changed the title
Request parts not found in Spring Boot 2.4.0 project
Request parts not found when using Spring Framework 5.3 without nio-multipart-parser
Nov 13, 2020
After upgrading Spring Boot to 2.4.0 my tests started to fail:
Reason is this code in org.springframework.restdocs.webtestclient.WebTestClientRequestConverter:
Spring Boot 2.4.0 does not depend on
org.synchronoss.cloud:nio-multipart-parser
anymore, so method always returns empty list.As a workaround this dependency should be added explicitly to the project:
The text was updated successfully, but these errors were encountered: