Command
printf '\x00\x00\x00\x00\x00' |
curl \
-v -s --http2 \
--data-binary @- \
--output - \
-H "Content-Type: application/grpc" \
-H "TE: trailers" \
"${GRPC_ENDPOINT:?}/grpc.health.v1.Health/Check" |
hexdump -C
Simply send an empty message to /grpc.health.v1.Health/Check.
Example
- Request:
00 00 00 00 00- The first byte
00is the compression flag (0 = uncompressed) - The next 4 bytes
00 00 00 00represent the message length (0 bytes)
- The first byte
$ printf '\x00\x00\x00\x00\x00' | curl -v -s --http2 -H "Content-Type: application/grpc" -H "TE: trailers" --data-binary @- --output - "${GRPC_ENDPOINT:?}/grpc.health.v1.Health/Check" | hexdump -C
... omitted ...
00000000 00 00 00 00 02 08 01 |.......|
00000007
- Response
00 00 00 00 02 08 01- The first 5 bytes
00 00 00 00 02- The first byte
00is the compression flag (0 = uncompressed) - The next 4 bytes
00 00 00 02represent the message length (2 bytes)
- The first byte
- The remaining 2 bytes
08 01- This is a Protocol Buffers encoded message
08indicates this is field number1ofHealthCheckResponse(field_number << 3) | wire_type==(status << 3) | VARINT==(1 << 3) | 0==08- ref: Message Structure | Encoding | Protocol Buffers Documentation
01indicates thatServingStatusisSERVING
- The first 5 bytes