Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
go/ | 12-May-2024 | - | 515 | 400 | ||
python/greeter/ | 12-May-2024 | - | 253 | 188 | ||
swift/Greeter/ | 12-May-2024 | - | 481 | 313 | ||
ts/greeter/ | 12-May-2024 | - | 351 | 282 | ||
README.md | D | 12-May-2024 | 1,020 | 35 | 25 | |
generate.sh | D | 12-May-2024 | 1.4 KiB | 72 | 31 | |
greeter.fbs | D | 12-May-2024 | 223 | 15 | 11 |
README.md
1## Languages known issues 2 3### Python 4 5- Assert the type required in your server/client since python is able to receive `Bytes array` or `utf8 strings`. 6 7```python 8def SayHello(self, request, context): 9 # request might be a byte array or a utf8 string 10 11 r = HelloRequest.HelloRequest().GetRootAs(request, 0) 12 reply = "Unknown" 13 if r.Name(): 14 reply = r.Name() 15 # Issues might happen if type checking isnt present. 16 # thus encoding it as a `reply.decode('UTF-8')` 17 return build_reply("welcome " + reply.decode('UTF-8')) 18 19``` 20 21This can be prevented by making sure all the requests coming to/from python are `Bytes array` 22 23```python 24def say_hello(stub, builder): 25 hello_request = bytes(builder.Output()) 26 reply = stub.SayHello(hello_request) 27 r = HelloReply.HelloReply.GetRootAs(reply) 28 print(r.Message()) 29``` 30 31### Go 32 33- Always requires the `content-type` of the payload to be set to `application/grpc+flatbuffers` 34 35example: `.SayHello(ctx, b, grpc.CallContentSubtype("flatbuffers"))`