lib/httpx/plugins/grpc/call.rb in httpx-1.1.4 vs lib/httpx/plugins/grpc/call.rb in httpx-1.1.5

- old
+ new

@@ -9,10 +9,11 @@ def initialize(response) @response = response @decoder = ->(z) { z } @consumed = false + @grpc_response = nil end def inspect "#GRPC::Call(#{grpc_response})" end @@ -32,12 +33,10 @@ end 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) end @consumed = true