mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-11-13 00:01:28 -05:00
making grpc code more shape-friendly
This commit is contained in:
parent
b0dfe68ebe
commit
354bba3179
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user