Skip to content

Commit

Permalink
Set content type. See #10959
Browse files Browse the repository at this point in the history
  • Loading branch information
bsideup committed Mar 16, 2024
1 parent 053ab0f commit 20b2d39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions netty/src/main/java/io/grpc/netty/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ public static Http2Headers convertClientHeaders(Metadata headers,
Preconditions.checkNotNull(method, "method");

// Discard any application supplied duplicates of the reserved headers
headers.discardAll(CONTENT_TYPE_KEY);
headers.discardAll(GrpcUtil.TE_HEADER);
headers.discardAll(GrpcUtil.USER_AGENT_KEY);

Expand All @@ -244,7 +243,6 @@ public static Http2Headers convertClientHeaders(Metadata headers,

public static Http2Headers convertServerHeaders(Metadata headers) {
// Discard any application supplied duplicates of the reserved headers
headers.discardAll(CONTENT_TYPE_KEY);
headers.discardAll(GrpcUtil.TE_HEADER);
headers.discardAll(GrpcUtil.USER_AGENT_KEY);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

public abstract class ClientChannelService implements BindableService {

public static final Metadata.Key<String> CONTENT_TYPE_KEY = Metadata.Key.of("content-type", Metadata.ASCII_STRING_MARSHALLER);

static String TUNNEL_SERVICE = "io.grpc.Tunnel";

static MethodDescriptor<ByteBuf, ByteBuf> NEW_TUNNEL_METHOD = MethodDescriptor
Expand Down Expand Up @@ -62,6 +64,8 @@ protected void doBeginRead() {
throw new RuntimeException(e);
}

headers.put(CONTENT_TYPE_KEY, "application/grpc+raw");

serverCall.start(
new ClientCall.Listener<ByteBuf>() {

Expand Down

0 comments on commit 20b2d39

Please sign in to comment.