@ -54,9 +54,10 @@ public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
@@ -54,9 +54,10 @@ public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
@ -43,6 +44,11 @@ public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
@@ -43,6 +44,11 @@ public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
@ -54,4 +60,22 @@ public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
@@ -54,4 +60,22 @@ public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
@ -77,6 +78,7 @@ public class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonD
@@ -77,6 +78,7 @@ public class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonD
@ -66,6 +67,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
@@ -66,6 +67,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
@ -197,6 +197,43 @@ public class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
@@ -197,6 +197,43 @@ public class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
@ -378,7 +378,7 @@ You can also use https://github.com/jayway/JsonPath[JSONPath] expressions, as fo
@@ -378,7 +378,7 @@ You can also use https://github.com/jayway/JsonPath[JSONPath] expressions, as fo
[[webtestclient-stream]]
=== Streaming Responses
To test infinite streams (for example, `"text/event-stream"` or `"application/stream+json"`),
To test infinite streams (for example, `"text/event-stream"` or `"application/x-ndjson"`),
you need to exit the chained API (by using `returnResult`), immediately after the response status
and header assertions, as the following example shows:
https://en.wikipedia.org/wiki/JSON_streaming[line-delimited JSON] format. Other
streaming media types may be registered with the encoder.
* For SSE the `Jackson2Encoder` is invoked per event and the output is flushed to ensure
delivery without delay.
@ -852,7 +853,7 @@ To configure all three in WebFlux, you'll need to supply a pre-configured instan
@@ -852,7 +853,7 @@ To configure all three in WebFlux, you'll need to supply a pre-configured instan
[.small]#<<web.adoc#mvc-ann-async-http-streaming, Web MVC>>#
When streaming to the HTTP response (for example, `text/event-stream`,
`application/stream+json`), it is important to send data periodically, in order to
`application/x-ndjson`), it is important to send data periodically, in order to
reliably detect a disconnected client sooner rather than later. Such a send could be a
comment-only, empty SSE event or any other "no-op" data that would effectively serve as