Add Flux<Part> ServerRequest.parts()

This commit introduces Flux<Part> ServerRequest.parts() that delegates
to ServerWebExchange.getParts() and offers an alternative,
streaming way of accessing multipart data.

Closes gh-23131
This commit is contained in:
Arjen Poutsma
2019-06-14 10:33:42 +02:00
parent 11c7907a59
commit 92981ac9de
8 changed files with 133 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -249,6 +249,13 @@ public final class MockServerRequest implements ServerRequest {
return (Mono<MultiValueMap<String, Part>>) this.body;
}
@Override
@SuppressWarnings("unchecked")
public Flux<Part> parts() {
Assert.state(this.body != null, "No body");
return (Flux<Part>) this.body;
}
@Override
public ServerWebExchange exchange() {
Assert.state(this.exchange != null, "No exchange");