Ensure StringDecoder supports multiline delimiters
This commit makes sure the StringDecoder supports stripping off multi-line delimiters, such as \r\n. Specifically, we ensure that the delimiter is stripped from the joined buffer. Closes gh-26511
This commit is contained in:
@@ -125,10 +125,10 @@ class StringDecoderTests extends AbstractDecoderTests<StringDecoder> {
|
||||
);
|
||||
|
||||
testDecode(input, String.class, step -> step
|
||||
.expectNext("")
|
||||
.expectNext("").as("1st")
|
||||
.expectNext("abc")
|
||||
.expectNext("defghi")
|
||||
.expectNext("")
|
||||
.expectNext("").as("2nd")
|
||||
.expectNext("jklmno")
|
||||
.expectNext("pqr")
|
||||
.expectNext("stuvwxyz")
|
||||
@@ -136,6 +136,21 @@ class StringDecoderTests extends AbstractDecoderTests<StringDecoder> {
|
||||
.verify());
|
||||
}
|
||||
|
||||
@Test
|
||||
void decodeNewlinesAcrossBuffers() {
|
||||
Flux<DataBuffer> input = Flux.just(
|
||||
stringBuffer("\r"),
|
||||
stringBuffer("\n"),
|
||||
stringBuffer("xyz")
|
||||
);
|
||||
|
||||
testDecode(input, String.class, step -> step
|
||||
.expectNext("")
|
||||
.expectNext("xyz")
|
||||
.expectComplete()
|
||||
.verify());
|
||||
}
|
||||
|
||||
@Test
|
||||
void maxInMemoryLimit() {
|
||||
Flux<DataBuffer> input = Flux.just(
|
||||
|
||||
Reference in New Issue
Block a user