I have an annotated service. Some clients POST requests with the content in plaintext. Other clients POST requests gzipped and include the header Content-Encoding: gzip
.
The gzipped requests are failing to be decoded as proto values, because they are not unzipped first.
How do I decorate my action so that it selectively gunzips the body based upon the header value?
@Post("/foo/bar)
@Consumes("application/x-protobuf")
@Produces("application/x-protobuf")
fun setFooBar(
request: SetFooBarRequest,
headers: RequestHeaders,
): SetFooBarResponse { ... }
fails with Protocol message tag had invalid wire type.
(ie this blob is not a proto value), but only for requests where Content-Encoding: gzip
DecodingService automatically decodes
gzip
,deflate
andbrotli
by default. You can applyDecodingService
usingServerBuilder.decorate()
. For example: