Ktor client fetch protocol buffers content


#1

Question:

Is it possible to use Ktor client to fetch binary encoded content using protocol buffers ?
So the server would serve a response having in the body content binary data encoded using Google Protocol Buffers, ie I would need to be able to read the response as raw byte arrays.

Thank you, kindly
Luis Oscar Trigueiros


#2

Sure. I assume you mean a simple HTTP 1.1 server literally marshalling bytes into the response body. Just take byte responses like you would any other ktor client call and use the byte array unmarshaller of your protobuf library of choice. If you mean gRPC, no, that’s a different deal.