mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-08 00:02:42 -04:00
making grpc code more shape-friendly
This commit is contained in:
parent
b0dfe68ebe
commit
354bba3179
@ -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)
|
||||
|
@ -37,6 +37,7 @@ module HTTPX
|
||||
class Inflater
|
||||
def initialize(response)
|
||||
@response = response
|
||||
@grpc_encodings = nil
|
||||
end
|
||||
|
||||
def call(message, &blk)
|
||||
|
Loading…
x
Reference in New Issue
Block a user