We need to make a POST request to hyperskill.org and output the 10th byte of the response body to the console (byte is an integer from 0 to 255).
Which code fragment correctly accomplishes this task?
1)
suspend fun main(args: Array<String>) {
val client = HttpClient(CIO)
val response: HttpResponse = client.post("https://hyperskill.org/")
val body: ByteArray = response.body()
println(body[10])
client.close()
}
2)
suspend fun main(args: Array<String>) {
val client = HttpClient(CIO)
val response: HttpResponse = client.post("https://hyperskill.org/")
val body: ByteArray = response.body()
println(body[9])
client.close()
}
3)
suspend fun main(args: Array<String>) {
val client = HttpClient(CIO)
val response: HttpResponse = client.get("https://hyperskill.org/")
val body: ByteArray = response.body().asList()
println(body[9])
client.close()
}
4)
suspend fun main(args: Array<String>) {
val client = HttpClient(CIO)
val response: HttpResponse = client.post("https://hyperskill.org/")
val body: ByteArray = response.body().asList()
println(body[10])
client.close()
}
5)
suspend fun main(args: Array<String>) {
val client = HttpClient(CIO)
val response: HttpResponse = client.post("https://hyperskill.org/")
val body: ByteArray = response.body().asList()
println(body[9])
client.close()
}