Description
- Searched the repo's previous issues for similar reports.
- Searched the internet for any similar reports.
Issue Summary
I am encountering an unusual issue with the response object for a gRPC message. While the statusCode
indicates ok
and result
returns success, the headers provide contradictory information. Specifically, the headers contain a status code of 2
, and the grpc-message
reports an error.
This conflicting information is making it challenging to determine whether an operation was successful or not.
Detailed Description
I've confirmed that this issue originates from the client side by using Postman to access the same endpoint, which returns the correct information.
iOS Response:
In the iOS response, the following points illustrate the inconsistency:
- The status code is displayed as
ok
/0
. - The headers show a
statusCode
of2
/unknown error
. - The
grpc-message
in the headers also reports an error.
Postman Response:
Contrastingly, when using Postman, I receive the correct response with no contradictory information.
Possible Cause
Through my investigation, I believe I've identified a potential cause of this issue. In the ProtocolClient
, specifically in the unary(path:request:headers:completion:)
function, the onResponse
block checks response.code != .ok
to throw an error. However, in this case, response.code
is 0
, while the headers indicate 2
. Consequently, success
is returned instead of raising a ConnectError
with .failure
.