From 8ecc9125842a86ed30f61eb76d5031bd64a824a8 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Fri, 17 Aug 2018 01:27:12 -0400 Subject: [PATCH] Removes commented out code --- .../ModifyResponseBodyGatewayFilterFactory.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite/ModifyResponseBodyGatewayFilterFactory.java b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite/ModifyResponseBodyGatewayFilterFactory.java index 33d4f1d8c..a44d6f705 100644 --- a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite/ModifyResponseBodyGatewayFilterFactory.java +++ b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite/ModifyResponseBodyGatewayFilterFactory.java @@ -99,12 +99,10 @@ public class ModifyResponseBodyGatewayFilterFactory return bodyInserter.insert(outputMessage, new BodyInserterContext()) .then(Mono.defer(() -> { Flux messageBody = outputMessage.getBody(); - //TODO: if (inputStream instanceof Mono) { - HttpHeaders headers = getDelegate().getHeaders(); - if (/*headers.getContentLength() < 0 &&*/ !headers.containsKey(HttpHeaders.TRANSFER_ENCODING)) { - messageBody = messageBody.doOnNext(data -> headers.setContentLength(data.readableByteCount())); - } - // } + HttpHeaders headers = getDelegate().getHeaders(); + if (!headers.containsKey(HttpHeaders.TRANSFER_ENCODING)) { + messageBody = messageBody.doOnNext(data -> headers.setContentLength(data.readableByteCount())); + } //TODO: use isStreamingMediaType? return getDelegate().writeWith(messageBody); }));