diff --git a/lib/httpx/plugins/grpc/call.rb b/lib/httpx/plugins/grpc/call.rb index 9ed5d7ba..148b54ed 100644 --- a/lib/httpx/plugins/grpc/call.rb +++ b/lib/httpx/plugins/grpc/call.rb @@ -11,6 +11,7 @@ module HTTPX @response = response @decoder = ->(z) { z } @consumed = false + @grpc_response = nil end def inspect @@ -34,9 +35,7 @@ module HTTPX private def grpc_response - return @grpc_response if defined?(@grpc_response) - - @grpc_response = if @response.respond_to?(:each) + @grpc_response ||= if @response.respond_to?(:each) Enumerator.new do |y| Message.stream(@response).each do |message| y << @decoder.call(message) diff --git a/lib/httpx/plugins/grpc/grpc_encoding.rb b/lib/httpx/plugins/grpc/grpc_encoding.rb index b6db45c4..3beffcfb 100644 --- a/lib/httpx/plugins/grpc/grpc_encoding.rb +++ b/lib/httpx/plugins/grpc/grpc_encoding.rb @@ -37,6 +37,7 @@ module HTTPX class Inflater def initialize(response) @response = response + @grpc_encodings = nil end def call(message, &blk)