Merge branch '5.2.x' into master
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -25,6 +25,7 @@ import reactor.core.publisher.Flux;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.NettyDataBufferFactory;
|
||||
import org.springframework.core.testfixture.io.buffer.LeakAwareDataBufferFactory;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpResponse;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -63,6 +64,13 @@ public class HttpHeadResponseDecoratorTests {
|
||||
assertThat(this.response.getHeaders().getContentLength()).isEqualTo(length);
|
||||
}
|
||||
|
||||
@Test // gh-25908
|
||||
public void writeWithGivenTransferEncoding() {
|
||||
Flux<DataBuffer> body = Flux.just(toDataBuffer("data1"), toDataBuffer("data2"));
|
||||
this.response.getHeaders().add(HttpHeaders.TRANSFER_ENCODING, "chunked");
|
||||
this.response.writeWith(body).block();
|
||||
assertThat(this.response.getHeaders().getContentLength()).isEqualTo(-1);
|
||||
}
|
||||
|
||||
private DataBuffer toDataBuffer(String s) {
|
||||
DataBuffer buffer = this.bufferFactory.allocateBuffer();
|
||||
|
||||
Reference in New Issue
Block a user