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 @response = response
@decoder = ->(z) { z } @decoder = ->(z) { z }
@consumed = false @consumed = false
@grpc_response = nil
end end
def inspect def inspect
@ -34,9 +35,7 @@ module HTTPX
private private
def grpc_response 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| Enumerator.new do |y|
Message.stream(@response).each do |message| Message.stream(@response).each do |message|
y << @decoder.call(message) y << @decoder.call(message)

View File

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