Content-Type not being set

47 views
Skip to first unread message

Mustafa Khalil

unread,
Feb 16, 2021, 6:27:13 AM2/16/21
to grpc.io
Good afternoon, 

 Hope you are all doing well.
 I am trying to implement the code generators for the grpc flatbuffers library, however i am facing an issue. I have been testing the currnent implementation that are implemented in the flatbuffers library and upgrading them to support the latest gRPC v1.35.0. The issue comes to light whenever i try to call a grpc-go server from any other implementation, the grpc-go server requires a `content-type` header of type `application/grpc+flatbuffers` which makes sense. However whenever i try to set that content-type from any other client the client ignores the set header and defaults to `application/grpc` which crashes the go gRPC server since the server is expecting a header with `+flatbuffers` in it for it to decode and encode the data properly. How should we solve this so we can include the support of flatbuffers into grpc, which some languages have integrated properly with (swift, ts, python).

Is this an issue that should be reported in the `grpc/grpc-go` repository or the main repository? and if so what would be the solution for this instance, since according to the https://github.com/grpc/grpc/blob/v1.35.0/doc/PROTOCOL-HTTP2.md documentation we can set a custom suffix `Content-Type → "content-type" "application/grpc" [("+proto" / "+json" / {custom})]`

example: Go lang to Go lang

```

:method POST
:scheme http 
:path /models.Greeter/SayHello 
:authority localhost:3000 
content-type application/grpc+flatbuffers 
user-agent grpc-go/1.35.0 te trailers grpc-timeout 9997779u
```
 As you can see if its being called from go lang it doesn't have issues however when I call the server from the python client it clearly doesn't append the +flatbuffers suffix

python to Go lang

```

:scheme http 

:method POST

:authority localhost:3000 
:path /models.Greeter/SayHello 
te trailers 
content-type application/grpc 
user-agent grpc-python/1.35.0 grpc-c/14.0.0 (osx; chttp2)
```

i've tried this as a solution `with_call(hello_request, metadata=[('content-type', 'application/grpc+flatbuffers')])`. 

Easwar Swaminathan

unread,
Feb 17, 2021, 1:10:21 PM2/17/21
to grpc.io
If the gRPC-Go server is crashing, please do file an issue under the grpc-go repository.

For the issue where the python client is not setting the appropriate content-type, please file an issue there.

Thanks

Eric Anderson

unread,
Feb 17, 2021, 6:30:59 PM2/17/21
to grpc.io
Go is the only implementation to support sending the +format syntax. All other implementations ignore it completely when receiving.
Reply all
Reply to author
Forward
0 new messages