trpc-proto-http: fix response header parsing in HttpConsumerInvoker by PingruiLi · Pull Request #135 · trpc-group/trpc-java

@PingruiLi

The previous implementation iterated over HeaderElement objects and
called element.getName() to extract header values. This only returns
the token before the first '=' or ';' delimiter, causing truncation
of composite header values such as:

  Content-Type: application/json; charset=utf-8  ->  "application/json"
  X-Token: key=abc123                            ->  "key"
  Set-Cookie: sessionId=abc; Path=/; HttpOnly    ->  "sessionId"

Fix this by calling header.getValue() directly to obtain the complete
header value, consistent with the approach already used in
Http2ConsumerInvoker. Also remove the now-unused HeaderElement import.

Add HttpConsumerInvokerTest covering:
- simple header values (no delimiters)
- composite values containing semicolons (core fix scenario)
- values containing equals signs
- multiple headers all stored correctly
- header values stored as byte[] (tRPC protocol consistency)
- non-200 status code throws TRpcException
- zero Content-Length returns empty response body
- complex cookie header with multiple semicolons and equals signs
- non-zero Content-Length with response body decoded correctly