Fix regression in AbstractJackson2Encoder
Closes gh-29274
This commit is contained in:
parent
b3afafbf5a
commit
1afc1fc90d
|
|
@ -198,6 +198,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple
|
||||||
bufferFactory.join(Arrays.asList(bufferFactory.wrap(prefix), dataBuffer)) :
|
bufferFactory.join(Arrays.asList(bufferFactory.wrap(prefix), dataBuffer)) :
|
||||||
dataBuffer);
|
dataBuffer);
|
||||||
})
|
})
|
||||||
|
.switchIfEmpty(Mono.fromCallable(() -> bufferFactory.wrap(helper.getPrefix())))
|
||||||
.concatWith(Mono.fromCallable(() -> bufferFactory.wrap(helper.getSuffix())));
|
.concatWith(Mono.fromCallable(() -> bufferFactory.wrap(helper.getSuffix())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,14 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
|
||||||
.verifyComplete());
|
.verifyComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void encodeNonStreamEmpty() {
|
||||||
|
testEncode(Flux.empty(), Pojo.class, step -> step
|
||||||
|
.consumeNextWith(expectString("["))
|
||||||
|
.consumeNextWith(expectString("]"))
|
||||||
|
.verifyComplete());
|
||||||
|
}
|
||||||
|
|
||||||
@Test // gh-29038
|
@Test // gh-29038
|
||||||
void encodeNonStreamWithErrorAsFirstSignal() {
|
void encodeNonStreamWithErrorAsFirstSignal() {
|
||||||
String message = "I'm a teapot";
|
String message = "I'm a teapot";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue