Skip to content

Commit

Permalink
Merge pull request grpc-ecosystem#188 from kazegusuri/trailer-on-error
Browse files Browse the repository at this point in the history
send Trailer header on error
  • Loading branch information
yugui authored Jul 11, 2016
2 parents 04d03d2 + 5efdfda commit e712347
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ func testABELookupNotFound(t *testing.T) {
if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want {
t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want)
}
if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want {
t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want)
}
if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want {
t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want)
}
}

func testABEList(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions runtime/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW
}

handleForwardResponseServerMetadata(w, md)
handleForwardResponseTrailerHeader(w, md)
st := HTTPStatusFromCode(grpc.Code(err))
w.WriteHeader(st)
if _, err := w.Write(buf); err != nil {
Expand Down

0 comments on commit e712347

Please sign in to comment.