override fun bytes(): ByteArray = parametersOf(
"error" to listOf("invalid_request"),
"error_description" to listOf("client_id was not valid")
).formUrlEncode().toByteArray()
o
orangy
08/02/2018, 11:07 PM
Since
formUrlEncode
returns a String, and String will automatically be sent as bytes, you don’t need custom OutgoingContent
orangy
08/02/2018, 11:09 PM
You can just a make a function something like
respondUrlEncoded
which will have similar signature to
parametersOf
and encode them
orangy
08/02/2018, 11:09 PM
So you will just use
Copy code
call.respondUrlEncoded(
"error" to listOf("invalid_request"),
"error_description" to listOf("client_id was not valid")
)
➕ 1
b
bdawg.io
08/02/2018, 11:11 PM
I kind of like the idea of having that take in a
Parameters
so it would abstract where they were received from and it doesn’t seem to add much at the call site
Copy code
call.respondUrlEncoded(parametersOf(
"error" to listOf("invalid_request"),
"error_description" to listOf("client_id was not valid")
))