grpc-swift
grpc-swift copied to clipboard
Being able to deserialize Status from a raw payload
Is your feature request related to a problem? Please describe it.
Some gRPC services are hidden behind proxies that translate RESTful into gRPC like:
- https://github.com/grpc-ecosystem/grpc-gateway
- https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_http1_bridge_filter
Such a middleman can handle both application/json and application/x-protobuf. In the former case, however, the server would respond using application/x-protobuf as well. In such a scenario, it is necessary to deserialize the gRPC error message manually.
Describe the solution you'd like
Status could get additional constructor init<Bytes: SwiftProtobufContiguousBytes>(serializedBytes bytes: Bytes) in a similar fasion Go library does