Skip to content

Commit

Permalink
docs need type assertion on proto.Message (grpc-ecosystem#1026)
Browse files Browse the repository at this point in the history
* docs need type assertion on proto.Message

* Update docs/_docs/customizingyourgateway.md

Co-Authored-By: Johan Brandhorst <johan.brandhorst@gmail.com>
  • Loading branch information
zachgersh and johanbrandhorst committed Sep 3, 2019
1 parent 30d69eb commit fff5b4c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/_docs/customizingyourgateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ Or you might want to mutate the response messages to be returned.
1. Write a filter function.
```go
func myFilter(ctx context.Context, w http.ResponseWriter, resp proto.Message) error {
w.Header().Set("X-My-Tracking-Token", resp.Token)
resp.Token = ""
t, ok := resp.(*externalpb.Tokenizer)
if ok {
w.Header().Set("X-My-Tracking-Token", t.Token)
t.Token = ""
}
return nil
}
```
Expand Down

0 comments on commit fff5b4c

Please sign in to comment.