Skip to content

Commit bd7cea1

Browse files
committed
* added support for streaming response modification
Fixes spring-cloudgh-2275
1 parent 7dce0e5 commit bd7cea1

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
<plugin>
144144
<groupId>org.codehaus.mojo</groupId>
145145
<artifactId>flatten-maven-plugin</artifactId>
146-
<version>1.3.0</version>
147146
</plugin>
148147
<plugin>
149148
<groupId>io.spring.javaformat</groupId>

spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite/ModifyResponseBodyGatewayFilterFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,11 @@ public Mono<Void> writeWith(Publisher<? extends DataBuffer> body) {
287287
exchange.getResponse().getHeaders());
288288
return bodyInserter.insert(outputMessage, new BodyInserterContext())
289289
.then(Mono.defer(() -> {
290-
Mono<DataBuffer> messageBody = writeBody(getDelegate(),
291-
outputMessage, outClass);
290+
Mono<DataBuffer> messageBody = writeBody(getDelegate(), outputMessage, outClass);
292291
HttpHeaders headers = getDelegate().getHeaders();
293292
if (!headers.containsKey(HttpHeaders.TRANSFER_ENCODING)
294293
|| headers.containsKey(HttpHeaders.CONTENT_LENGTH)) {
295-
messageBody = messageBody.doOnNext(data -> headers
296-
.setContentLength(data.readableByteCount()));
294+
messageBody = messageBody.doOnNext(data -> headers.setContentLength(data.readableByteCount()));
297295
}
298296

299297
if (StringUtils.hasText(config.newContentType)) {

0 commit comments

Comments
 (0)