Module: GRPCWeb::ClientExecutor
- Extended by:
- ContentTypes
- Defined in:
- lib/grpc_web/client/client_executor.rb
Overview
Client execution concerns
Constant Summary collapse
- GRPC_STATUS_HEADER =
'grpc-status'- GRPC_MESSAGE_HEADER =
'grpc-message'- GRPC_HEADERS =
%W[x-grpc-web #{GRPC_STATUS_HEADER} #{GRPC_MESSAGE_HEADER}].freeze
Constants included from ContentTypes
GRPCWeb::ContentTypes::ALL_CONTENT_TYPES, GRPCWeb::ContentTypes::BASE64_CONTENT_TYPES, GRPCWeb::ContentTypes::DEFAULT_CONTENT_TYPE, GRPCWeb::ContentTypes::JSON_CONTENT_TYPE, GRPCWeb::ContentTypes::PROTO_CONTENT_TYPE, GRPCWeb::ContentTypes::TEXT_CONTENT_TYPE, GRPCWeb::ContentTypes::TEXT_PROTO_CONTENT_TYPE, GRPCWeb::ContentTypes::UNSPECIFIED_CONTENT_TYPES
Class Method Summary collapse
Class Method Details
.request(uri, rpc_desc, params = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/grpc_web/client/client_executor.rb', line 19 def request(uri, rpc_desc, params = {}) req_proto = rpc_desc.input.new(params) marshalled_proto = rpc_desc.marshal_proc.call(req_proto) frame = ::GRPCWeb::MessageFrame.payload_frame(marshalled_proto) request_body = ::GRPCWeb::MessageFraming.pack_frames([frame]) resp = post_request(uri, request_body) resp_body = handle_response(resp) rpc_desc.unmarshal_proc(:output).call(resp_body) end |