diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java index 6c0ff7882b..15fa32670d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -250,9 +250,9 @@ public abstract class BodyInserters { * @return a {@code BodyInserter} that writes multipart data * @see MultipartBodyBuilder */ - public static MultipartInserter fromMultipartData(MultiValueMap multipartData) { + public static MultipartInserter fromMultipartData(MultiValueMap multipartData) { Assert.notNull(multipartData, "'multipartData' must not be null"); - return new DefaultMultipartInserter().with(multipartData); + return new DefaultMultipartInserter().withInternal(multipartData); } /** @@ -477,8 +477,13 @@ public abstract class BodyInserters { @Override public MultipartInserter with(MultiValueMap values) { + return withInternal(values); + } + + @SuppressWarnings("unchecked") + private MultipartInserter withInternal(MultiValueMap values) { Assert.notNull(values, "'values' must not be null"); - for (Map.Entry> entry : values.entrySet()) { + for (Map.Entry> entry : values.entrySet()) { for (Object value : entry.getValue()) { this.builder.part(entry.getKey(), value); }