Revert "Make all "grpc-" metadata field names reserved (#1391)" (#1400)

This reverts commit 3ddcdc268d88595eb2f3721f7dc87970a6c3ab6e.
This commit is contained in:
dfawley
2017-07-28 11:04:27 -07:00
committed by GitHub
parent aa5b2f7368
commit 971efedc20
2 changed files with 11 additions and 6 deletions

View File

@ -121,14 +121,19 @@ func isReservedHeader(hdr string) bool {
if hdr != "" && hdr[0] == ':' {
return true
}
if strings.HasPrefix(hdr, "grpc-") {
return true
}
switch hdr {
case "content-type", "te":
case "content-type",
"grpc-message-type",
"grpc-encoding",
"grpc-message",
"grpc-status",
"grpc-timeout",
"grpc-status-details-bin",
"te":
return true
default:
return false
}
return false
}
// isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders

View File

@ -1577,7 +1577,7 @@ func TestIsReservedHeader(t *testing.T) {
{"grpc-encoding", true},
{"grpc-message", true},
{"grpc-status", true},
{"grpc-anything-else99999", true},
{"grpc-timeout", true},
{"te", true},
}
for _, tt := range tests {