Merge pull request #32141 from kzander91
* pr/32141: Polish "Simplify use of Reactor's cast operator" Simplify use of Reactor's cast operator Closes gh-32141
This commit is contained in:
commit
a7764dc61d
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -167,9 +167,8 @@ public class PartEventHttpMessageReader extends LoggingCodecSupport implements H
|
|||
Assert.state(headersToken != null, "Signal should be headers token");
|
||||
|
||||
HttpHeaders headers = headersToken.headers();
|
||||
Flux<MultipartParser.BodyToken> bodyTokens =
|
||||
flux.filter(t -> t instanceof MultipartParser.BodyToken)
|
||||
.cast(MultipartParser.BodyToken.class);
|
||||
Flux<MultipartParser.BodyToken> bodyTokens = flux.ofType(
|
||||
MultipartParser.BodyToken.class);
|
||||
return createEvents(headers, bodyTokens);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -240,9 +240,8 @@ class MultipartRouterFunctionIntegrationTests extends AbstractRouterFunctionInte
|
|||
|
||||
public Mono<ServerResponse> transferTo(ServerRequest request) {
|
||||
return request.body(BodyExtractors.toParts())
|
||||
.filter(FilePart.class::isInstance)
|
||||
.ofType(FilePart.class)
|
||||
.next()
|
||||
.cast(FilePart.class)
|
||||
.flatMap(part -> createTempFile()
|
||||
.flatMap(tempFile ->
|
||||
part.transferTo(tempFile)
|
||||
|
|
|
|||
Loading…
Reference in New Issue