Use text block where feasible

See gh-31916
This commit is contained in:
Yanming Zhou
2023-12-28 15:04:50 +08:00
committed by Stéphane Nicoll
parent 9d31537ae5
commit a35384fd57
9 changed files with 93 additions and 41 deletions

View File

@@ -66,8 +66,25 @@ class ServerSentEventHttpMessageReaderTests extends AbstractLeakCheckingTests {
void readServerSentEvents() {
MockServerHttpRequest request = MockServerHttpRequest.post("/")
.body(Mono.just(stringBuffer(
"id:c42\nevent:foo\nretry:123\n:bla\n:bla bla\n:bla bla bla\ndata:bar\n\n" +
"id:c43\nevent:bar\nretry:456\ndata:baz\n\ndata:\n\ndata: \n\n")));
"""
id:c42
event:foo
retry:123
:bla
:bla bla
:bla bla bla
data:bar
id:c43
event:bar
retry:456
data:baz
data:
data:\s
""")));
Flux<ServerSentEvent> events = this.reader
.read(ResolvableType.forClassWithGenerics(ServerSentEvent.class, String.class),

View File

@@ -33,10 +33,16 @@ public final class OuterSample {
descriptor;
static {
String[] descriptorData = {
"\n\014sample.proto\",\n\003Msg\022\013\n\003foo\030\001 \001(\t\022\030\n\004bl" +
"ah\030\002 \001(\0132\n.SecondMsg\"\031\n\tSecondMsg\022\014\n\004bla" +
"h\030\001 \001(\005B-\n\034org.springframework.protobufB" +
"\013OuterSampleP\001"
"""
\014sample.proto",
\003Msg\022\013
\003foo\030\001 \001(\t\022\030
\004blah\030\002 \001(\0132
.SecondMsg"\031
\tSecondMsg\022\014
\004blah\030\001 \001(\005B-
\034org.springframework.protobufB\013OuterSampleP\001"""
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,