Optional @RequestPart Mono arg resolves to Mono.empty

Closes gh-23060
This commit is contained in:
Ilya Lukyanovich
2019-05-31 16:48:02 +03:00
committed by Rossen Stoyanchev
parent ac29e9de6a
commit 27b5d2b288
2 changed files with 62 additions and 5 deletions

View File

@@ -99,13 +99,9 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageReaderArgu
// Mono<Part> or Flux<Part>
MethodParameter elementType = parameter.nested();
if (Part.class.isAssignableFrom(elementType.getNestedParameterType())) {
parts = (adapter.isMultiValue() ? parts : parts.take(1));
return Mono.just(adapter.fromPublisher(parts));
}
// We have to decode the content for each part, one at a time
if (adapter.isMultiValue()) {
return Mono.just(decodePartValues(parts, elementType, bindingContext, exchange, isRequired));
}
return Mono.just(adapter.fromPublisher(decodePartValues(parts, elementType, bindingContext, exchange, isRequired)));
}
// <T> or Mono<T>