making grpc code more shape-friendly

This commit is contained in:
HoneyryderChuck 2023-11-21 10:21:44 +00:00
parent b0dfe68ebe
commit 354bba3179
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -37,6 +37,7 @@ module HTTPX
class Inflater
def initialize(response)
@response = response
@grpc_encodings = nil
end
def call(message, &blk)