Skip to content

Commit

Permalink
remove headers that make grpc upset
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz committed Jun 25, 2019
1 parent df9d83f commit 282fa8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func prepareHeaders(ctx context.Context, hdr http.Header) context.Context {
// delete application/x-protobuf content-type
hdr.Del("content-type")

// delete headers that make gRPC upset
hdr.Del("user-agent")
hdr.Del("content-length")
hdr.Del("accept-encoding")

// keep every other headerin case-sensitive
// way, important for copying e.g. Authorization
for key, val := range hdr {
Expand Down
3 changes: 3 additions & 0 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func Test_prepareHeaders(t *testing.T) {
parent := context.Background()
hdr := make(http.Header)
hdr.Add("Content-Type", "test")
hdr.Add("accept-encoding", "blah")
hdr.Add("content-length", "7")
hdr.Add("user-agent", "whoever")
hdr.Add("Foo", "bar")

want := map[string][]string{
Expand Down

0 comments on commit 282fa8c

Please sign in to comment.