> ## Documentation Index
> Fetch the complete documentation index at: https://docs.httpmon.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# gRPC & Protobuf decoding

> Decode gRPC, gRPC-Web, and raw Protobuf bodies as readable JSON

httpmon automatically detects gRPC, gRPC-Web, and Protobuf content types and decodes binary bodies into readable JSON.

<Frame>
  <img src="https://mintcdn.com/pragmaticoslu/bRemsZDzBE12o32Z/images/screenshots/grpc-decoding.png?fit=max&auto=format&n=bRemsZDzBE12o32Z&q=85&s=9aef0e31a3a603e0f109d0e638d8f9cf" alt="httpmon gRPC-Web decoded body" width="5877" height="1788" data-path="images/screenshots/grpc-decoding.png" />
</Frame>

## Supported content types

httpmon decodes bodies with these content types:

| Content type                    | Decoder                                        |
| ------------------------------- | ---------------------------------------------- |
| `application/grpc`              | Protobuf (no frame stripping)                  |
| `application/grpc+proto`        | Protobuf                                       |
| `application/grpc-web`          | gRPC-Web (strips 5-byte frames, then Protobuf) |
| `application/grpc-web+proto`    | gRPC-Web                                       |
| `application/protobuf`          | Raw Protobuf                                   |
| `application/x-protobuf`        | Raw Protobuf                                   |
| `application/x-google-protobuf` | Raw Protobuf                                   |

## Named decoding with proto files

Use `--proto-path` to point httpmon at your `.proto` files. Field names appear in the decoded JSON instead of field numbers.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
httpmon --proto-path ./api/protos
httpmon --proto-path ./api/user.proto --proto-path ./api/order.proto
```

The flag accepts files or directories (recursively scans for `*.proto`). You can repeat it multiple times. Cross-file imports are resolved automatically.

With proto files, a `SayHello` response decodes as:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "message": "Hello, Alice! You are 30 years old.",
  "success": true
}
```

## Raw wire decoding

Without `--proto-path`, httpmon still decodes Protobuf bodies using raw wire format. Field numbers appear as JSON keys instead of names:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "1": "Hello, Alice! You are 30 years old.",
  "2": true
}
```

This works with any Protobuf payload — no proto files needed.

## gRPC-Web framing

gRPC-Web responses use 5-byte length-prefixed frames. httpmon strips these automatically before decoding the Protobuf payload. Compressed frames are noted but not decoded. Trailer frames are silently skipped.

## Import search paths

Use `--proto-include` to add import search directories, similar to protoc's `-I` flag. This is needed when your `.proto` files import definitions from other directories.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
httpmon --proto-path ./api/protos --proto-include ./vendor/protos
```

## Persisting proto paths

Save proto paths in `~/.httpmon/config.json` so you don't need `--proto-path` on every run:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "proto_paths": ["./api/protos"],
  "proto_includes": ["./vendor/protos"]
}
```

CLI `--proto-path` and `--proto-include` flags are appended to any paths already in the config file.

## Per-host proto registries

If different services use different `.proto` definitions, configure per-host registries in `~/.httpmon/config.json`:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "proto_hosts": {
    "api.example.com": {
      "paths": ["./protos/example"],
      "includes": ["./protos/common"]
    },
    "*.internal.dev": {
      "paths": ["./protos/internal"]
    }
  }
}
```

Host patterns support `*` wildcards. Per-host registries take precedence over the global `proto_paths` for matching hosts. Requests to hosts that don't match any pattern fall back to the global registry.

## Keyboard shortcuts

| Key | Action                                     |
| --- | ------------------------------------------ |
| `p` | Toggle between pretty-printed and raw JSON |
| `e` | Open decoded body in external editor       |
