Skip to content

Commit

Permalink
Updated doc and comments to reflect what the code is doing regarding …
Browse files Browse the repository at this point in the history
…prefixing gRPC metadata context when dealing with Permanent HTTP header keys
  • Loading branch information
crozzy authored and achew22 committed Jul 3, 2018
1 parent fa90cfb commit 39a18c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions docs/_docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ This parameter can be useful to pass request scoped context between the gateway
* [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15)
* HTTP request source IP is added as `X-Forwarded-For` gRPC request header
* HTTP request host is added as `X-Forwarded-Host` gRPC request header
* HTTP `Authorization` header is added as `authorization` gRPC request header
* HTTP `Authorization` header is added as `authorization` gRPC request header
* Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) are prefixed with `grpcgateway-` and added with their values to gRPC request header
* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`)
* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (after removing prefix 'Grpc-Metadata-')
* While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`.

3 changes: 2 additions & 1 deletion runtime/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import (
// parameters to or from a gRPC call.
const MetadataHeaderPrefix = "Grpc-Metadata-"

// MetadataPrefix is the prefix for grpc-gateway supplied custom metadata fields.
// MetadataPrefix is prepended to permanent HTTP header keys (as specified
// by the IANA) when added to the gRPC context.
const MetadataPrefix = "grpcgateway-"

// MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to
Expand Down

0 comments on commit 39a18c6

Please sign in to comment.