Skip to content

gRPC

Courier calls gRPC services directly. It reads the service description from server reflection or from your .proto files, so you don’t need to install protoc.

Choose gRPC from the command palette or from the menu next to New request. In a file, it looks like this:

### Say hello
# @proto ./protos/greeter.proto
# @import-path ./protos
GRPC localhost:50051/helloworld.Greeter/SayHello
authorization: Bearer {{token}}
{ "name": "{{who}}" }
> {%
client.test("OK", () => client.assert(response.status === "OK"));
%}
  • The request line is GRPC host:port/package.Service/Method.
  • Put grpcs:// or https:// in front of the host for TLS. Without it, the call is plaintext HTTP/2 (h2c).
  • Header lines are sent as metadata. Names ending in -bin take base64 values.
  • The body is the request message as JSON. Client and bidirectional streams take several messages separated by === lines.

Courier uses one of two sources:

  • Server reflection (grpc.reflection.v1, falling back to v1alpha). This is the default.
  • A .proto file, named with # @proto. Add # @import-path lines for folders its imports live in. Use Load .proto… in the Message tab to set it.

Descriptions are cached per server or proto file in .courier/schemas/. Click Refresh to fetch them again.

Messages follow the proto3 JSON rules: 64-bit integers are strings, enums are names, and well-known types such as Timestamp, Duration and Struct use their JSON forms.

The Message tab has:

  • a method picker with search, listing every service and method with its call kind,
  • a JSON editor that completes field names and enum values and flags unknown fields and bad enum values,
  • Generate example message, which fills in every field.

{{variables}} and references work in metadata and messages.

Press ⌘↵. Courier shows the status as its name and number, such as OK · 0 or NOT_FOUND · 5, with google.rpc.Status details when the server sends them.

  • Unary replies show as foldable JSON.
  • Streams show a live log of messages in and out.
  • Client and bidirectional streams get a composer to send more messages, End stream to half-close, and Cancel (⌘.).

Metadata, trailers and timing (DNS, connect, TLS, first message, total) have their own tabs.

Unary and client-streaming calls use the request timeout from Settings as their deadline. Server and bidirectional streams have no deadline in the app.

The connection uses the same proxy and TLS code as HTTP, so TLS verification and extra CA certificates apply.

  • The > {% %} handler runs on the reply, or on each message of a server or bidirectional stream, with response.status set to the status name.
  • Unary calls are kept in history, so run diff and {{name.response.body.$…}} references work.
  • Code exports a grpcurl command.
  • courier run runs gRPC requests and fails on a non-OK status unless --fail-on leaves out grpc.