isReservedHeader checks whether hdr belongs to HTTP2 headers reserved by gRPC protocol. Any other headers are classified as the user-specified metadata.
(hdr string)
| 94 | // reserved by gRPC protocol. Any other headers are classified as the |
| 95 | // user-specified metadata. |
| 96 | func isReservedHeader(hdr string) bool { |
| 97 | if hdr != "" && hdr[0] == ':' { |
| 98 | return true |
| 99 | } |
| 100 | switch hdr { |
| 101 | case "content-type", |
| 102 | "user-agent", |
| 103 | "grpc-message-type", |
| 104 | "grpc-encoding", |
| 105 | "grpc-message", |
| 106 | "grpc-status", |
| 107 | "grpc-timeout", |
| 108 | // Intentionally exclude grpc-previous-rpc-attempts and |
| 109 | // grpc-retry-pushback-ms, which are "reserved", but their API |
| 110 | // intentionally works via metadata. |
| 111 | "te": |
| 112 | return true |
| 113 | default: |
| 114 | return false |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | // isWhitelistedHeader checks whether hdr should be propagated into metadata |
| 119 | // visible to users, even though it is classified as "reserved", above. |
no outgoing calls