Fix JsonObjectDecoder with '[' starting chunk
Issue: SPR-15013
This commit is contained in:
parent
b70071fdda
commit
4021d239ab
|
@ -212,9 +212,6 @@ class JsonObjectDecoder extends AbstractDecoder<DataBuffer> {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.input.readableBytes() == 0) {
|
||||
this.index = 0;
|
||||
}
|
||||
return Flux.fromIterable(chunks);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,19 @@ public class JsonObjectDecoderTests extends AbstractDataBufferAllocatingTestCase
|
|||
.expectNext("{\"foo\": \"baz\"}")
|
||||
.expectComplete()
|
||||
.verify();
|
||||
|
||||
// SPR-15013
|
||||
source = Flux.just(stringBuffer("["), stringBuffer("{\"id\":1,\"name\":\"Robert\"}"),
|
||||
stringBuffer(","), stringBuffer("{\"id\":2,\"name\":\"Raide\"}"),
|
||||
stringBuffer(","), stringBuffer("{\"id\":3,\"name\":\"Ford\"}"),
|
||||
stringBuffer("]"));
|
||||
output = decoder.decode(source, null, null, Collections.emptyMap()).map(JsonObjectDecoderTests::toString);
|
||||
StepVerifier.create(output)
|
||||
.expectNext("{\"id\":1,\"name\":\"Robert\"}")
|
||||
.expectNext("{\"id\":2,\"name\":\"Raide\"}")
|
||||
.expectNext("{\"id\":3,\"name\":\"Ford\"}")
|
||||
.expectComplete()
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue