Description
I am integrating with a go application that uses the gRPC REST proxy to provide an HTTP API.
My HTTP client is reqwest
which uses hyper:0.13.3
at this stage.
The go application sends the following response:
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Trailer: Grpc-Trailer-Content-Type
Date: Wed, 01 Apr 2020 00:16:52 GMT
Transfer-Encoding: chunked
5e
{"error":"there are no existing invoices","message":"there are no existing invoices","code":2}
0
Grpc-Trailer-Content-Type: application/grpc
{"error":"there are no existing invoices","message":"there are no existing invoices","code":2}%
I've added a test to the hyper test suite that reproduces the issue: thomaseizinger@a608b28
I don't know whether this is a valid HTTP response. Reading through the HTTP spec, it seems like this grpc trailer stuff is violating the Transfer-Encoding: chunked
spec because the chunked is advertised as 0 bytes which from what I understand means the response is over, yet there are more bytes following.
Interestingly, curl
is able to handle the response just fine but that could just be an artifact of curl being very robust to these kind of mistakes.
Even if this is an invalid response, it would be nice if hyper
could be robust here and just ignore everything that is coming after the 0
chunk size indicator.