Class: GoogleRpcStatusTestService

Inherits:
Object
  • Object
show all
Includes:
GRPC::GenericService
Defined in:
src/ruby/spec/google_rpc_status_utils_spec.rb

Overview

A test service that fills in the “reserved” grpc-status-details-bin trailer, for client-side testing of GoogleRpcStatus protobuf extraction from trailers.

Instance Method Summary collapse

Methods included from GRPC::GenericService

included, underscore

Constructor Details

#initialize(encoded_rpc_status) ⇒ GoogleRpcStatusTestService

Returns a new instance of GoogleRpcStatusTestService.


123
124
125
# File 'src/ruby/spec/google_rpc_status_utils_spec.rb', line 123

def initialize(encoded_rpc_status)
  @encoded_rpc_status = encoded_rpc_status
end

Instance Method Details

#an_rpc(_, _) ⇒ Object


127
128
129
130
131
132
133
134
135
136
# File 'src/ruby/spec/google_rpc_status_utils_spec.rb', line 127

def an_rpc(_, _)
  # TODO: create a server-side utility API for sending a google rpc status.
  # Applications are not expected to set the grpc-status-details-bin
  # ("grpc"-fixed and reserved for library use) manually.
  # Doing so here is only for testing of the client-side api for extracting
  # a google rpc status, which is useful
  # when the interacting with a server that does fill in this trailer.
  fail GRPC::Unknown.new('test message',
                         'grpc-status-details-bin' => @encoded_rpc_status)
end