Module: HTTPX::Plugins::GRPC::RequestBodyMethods

Defined in:
lib/httpx/plugins/grpc.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



113
114
115
116
117
118
119
120
121
122
# File 'lib/httpx/plugins/grpc.rb', line 113

def initialize(*, **)
  super

  if (compression = @headers["grpc-encoding"])
    deflater_body = self.class.initialize_deflater_body(@body, compression)
    @body = Transcoder::GRPCEncoding.encode(deflater_body || @body, compressed: !deflater_body.nil?)
  else
    @body = Transcoder::GRPCEncoding.encode(@body, compressed: false)
  end
end