Skip to content

Commit e3f2e04

Browse files
authored
Multipart subs: add trailing data test (#6646)
1 parent 30788df commit e3f2e04

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/multipart/src/commonTest/kotlin/test/MultipartSubscriptionsMockServerTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ class MultipartSubscriptionsMockServerTest {
263263
}
264264
}
265265

266+
@Test
267+
fun trailingDataIsIgnored() = multipartSubsTest {
268+
enqueue(
269+
"\r\n--graphql\r\nContent-Type: application/json\r\n\r\n{\"payload\":{\"data\":{\"hello\":\"world\"}}}" +
270+
"\r\n--graphql--foo\r\nbar"
271+
)
272+
apolloClient.subscription(HelloSubscription()).toFlow().test(timeout = 300.milliseconds) {
273+
assertEquals("world", awaitItem().dataOrThrow().hello)
274+
awaitComplete()
275+
}
276+
}
277+
266278
@Test
267279
fun malformedMultipartTriggersReturnsErrorResponse() = multipartSubsTest {
268280
// No end boundary

0 commit comments

Comments
 (0)