lib/httpx/plugins/grpc.rb in httpx-0.22.5 vs lib/httpx/plugins/grpc.rb in httpx-0.23.0
- old
+ new
@@ -231,11 +231,11 @@
rpc_method = "/#{rpc_method}" unless rpc_method.start_with?("/")
rpc_method = "/#{@options.grpc_service}#{rpc_method}" if @options.grpc_service
uri.path = rpc_method
headers = HEADERS.merge(
- "grpc-accept-encoding" => ["identity", *@options.encodings.registry.keys]
+ "grpc-accept-encoding" => ["identity", *@options.encodings.keys]
)
unless deadline == Float::INFINITY
# convert to milliseconds
deadline = (deadline * 1000.0).to_i
headers["grpc-timeout"] = "#{deadline}m"
@@ -247,11 +247,11 @@
deflater = nil
compression = @options.grpc_compression == true ? "gzip" : @options.grpc_compression
if compression
headers["grpc-encoding"] = compression
- deflater = @options.encodings.registry(compression).deflater
+ deflater = @options.encodings[compression].deflater if @options.encodings.key?(compression)
end
headers.merge!(@options.call_credentials.call) if @options.call_credentials
body = if input.respond_to?(:each)
@@ -262,10 +262,10 @@
end
else
Message.encode(input, deflater: deflater)
end
- build_request(:post, uri, headers: headers, body: body)
+ build_request("POST", uri, headers: headers, body: body)
end
end
end
register_plugin :grpc, GRPC
end