Skip to content

Commit 8bd9c3d

Browse files
committed
Add body as clue
1 parent 34714d9 commit 8bd9c3d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

json-schema-validator/src/jvmTest/kotlin/io/github/optimumcode/json/schema/JsonSchemaStreamTest.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.kotest.assertions.asClue
44
import io.kotest.assertions.throwables.shouldNotThrowAny
55
import io.kotest.core.spec.style.FunSpec
66
import kotlinx.serialization.ExperimentalSerializationApi
7+
import java.io.ByteArrayInputStream
78
import java.net.URI
89
import java.net.http.HttpClient
910
import java.net.http.HttpRequest
@@ -28,11 +29,14 @@ class JsonSchemaStreamTest : FunSpec() {
2829
.timeout(Duration.ofSeconds(10))
2930
.header("User-Agent", "Mozilla/5.0")
3031
.build(),
31-
BodyHandlers.ofInputStream(),
32+
BodyHandlers.ofByteArray(),
3233
)
34+
val body = response.body()
3335
"Response code: ${response.statusCode()}".asClue {
34-
shouldNotThrowAny {
35-
response.body().use(JsonSchema::fromStream)
36+
body.toString(Charsets.UTF_8).asClue {
37+
shouldNotThrowAny {
38+
JsonSchema.fromStream(ByteArrayInputStream(body))
39+
}
3640
}
3741
}
3842
}

0 commit comments

Comments
 (0)