curious, when I run the ktor-server example for re...
# ktor
r
curious, when I run the ktor-server example for reading files:
Copy code
post("/templates") {
        val readChannel = call.receiveChannel()
        val text = readChannel.readRemaining().readText()
        <http://log.info|log.info> { text }
    }
I also get the boundaries from the multipart and metadata
Content-Disposition
and
Content-Type
. Is this really the desired behavior? It's most certainly not what I'd expect at least 😕
c
https://ktor.io/docs/server-requests.html#form_data 🤷 you need the
call.receiveMultipart()
1
r
Thanks, that seems a lot more useful 🙂
a
Is this really the desired behavior?
Yes, because the
ByteReadChannel
doesn't know anything about the request and the
readText()
method is called, which is designed to read the entire channel to a string.
r
hmm fair, but then I'd argue that it at least shouldn't be the default example 🙂 I think it's pretty safe to assume that most people reading the initial guide are just like me - searching for the simple uses and not the advanced 😉
c
where can I find this “initial guide”?