From 7206c860ec5503a54f42adc5305440647739c515 Mon Sep 17 00:00:00 2001 From: mpl Date: Sat, 4 Feb 2017 18:16:17 +0100 Subject: [PATCH] Catch and report non HTTP/2 error case --- call.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/call.go b/call.go index aa2f7bd..b224caf 100644 --- a/call.go +++ b/call.go @@ -199,6 +199,9 @@ func (cc *ClientConn) invoke(ctx context.Context, method string, args, reply int } defer res.Body.Close() + if !res.ProtoAtLeast(2, 0) { + return Errorf(codes.Internal, "grpc: HTTP/2 required; response was %v", res.Proto) + } if res.StatusCode != 200 { return Errorf(codes.Internal, "grpc: unexpected status code %v", res.Status) }