Module: HTTPX::Plugins::GRPC

Defined in:
lib/httpx/plugins/grpc.rb,
lib/httpx/plugins/grpc/call.rb,
lib/httpx/plugins/grpc/message.rb

Overview

This plugin adds DSL to build GRPC interfaces.

gitlab.com/os85/httpx/wikis/GRPC

Defined Under Namespace

Modules: InstanceMethods, Message, OptionsMethods, RequestBodyMethods, ResponseMethods, StringExtensions Classes: Call

Constant Summary collapse

DEADLINE =
60
MARSHAL_METHOD =
:encode
UNMARSHAL_METHOD =
:decode
HEADERS =
{
  "content-type" => "application/grpc",
  "te" => "trailers",
  "accept" => "application/grpc",
  # metadata fits here
  # ex "foo-bin" => base64("bar")
}.freeze

Class Method Summary collapse

Class Method Details

.configure(klass) ⇒ Object



57
58
59
60
# File 'lib/httpx/plugins/grpc.rb', line 57

def configure(klass)
  klass.plugin(:persistent)
  klass.plugin(:stream)
end

.extra_options(options) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/httpx/plugins/grpc.rb', line 62

def extra_options(options)
  options.merge(
    fallback_protocol: "h2",
    grpc_rpcs: {}.freeze,
    grpc_compression: false,
    grpc_deadline: DEADLINE
  )
end

.load_dependenciesObject



50
51
52
53
54
55
# File 'lib/httpx/plugins/grpc.rb', line 50

def load_dependencies(*)
  require "stringio"
  require "httpx/plugins/grpc/grpc_encoding"
  require "httpx/plugins/grpc/message"
  require "httpx/plugins/grpc/call"
end