Skip to content

Commit

Permalink
feat(transcoding): remove unnecessary encoding from response
Browse files Browse the repository at this point in the history
  • Loading branch information
zZHorizonZz authored Apr 19, 2024
1 parent 735774b commit 968cea6
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,28 +154,6 @@ private Future<Void> writeMessage(GrpcMessage message, boolean end) {
throw new IllegalStateException();
}

if (encoding != null && message != null && !encoding.equals(message.encoding())) {
switch (encoding) {
case "gzip":
message = GrpcMessageEncoder.GZIP.encode(message.payload());
break;
case "identity":
if (!message.encoding().equals("identity")) {
if (!message.encoding().equals("gzip")) {
return Future.failedFuture("Encoding " + message.encoding() + " is not supported");
}
Buffer decoded;
try {
decoded = GrpcMessageDecoder.GZIP.decode(message);
} catch (CodecException e) {
return Future.failedFuture(e);
}
message = GrpcMessage.message("identity", decoded);
}
break;
}
}

boolean trailersOnly = status != GrpcStatus.OK && !headersSent && end;

MultiMap responseHeaders = httpResponse.headers();
Expand All @@ -187,8 +165,6 @@ private Future<Void> writeMessage(GrpcMessage message, boolean end) {
}
}
responseHeaders.set("content-type", "application/json");
responseHeaders.set("grpc-encoding", encoding);
responseHeaders.set("grpc-accept-encoding", "gzip");
}

if (end) {
Expand Down

0 comments on commit 968cea6

Please sign in to comment.