Skip to content

Commit e712347

Browse files
authored
Merge pull request #188 from kazegusuri/trailer-on-error
send Trailer header on error
2 parents 04d03d2 + 5efdfda commit e712347

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

examples/integration_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,12 @@ func testABELookupNotFound(t *testing.T) {
468468
if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want {
469469
t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want)
470470
}
471+
if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want {
472+
t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want)
473+
}
474+
if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want {
475+
t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want)
476+
}
471477
}
472478

473479
func testABEList(t *testing.T) {

runtime/errors.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW
104104
}
105105

106106
handleForwardResponseServerMetadata(w, md)
107+
handleForwardResponseTrailerHeader(w, md)
107108
st := HTTPStatusFromCode(grpc.Code(err))
108109
w.WriteHeader(st)
109110
if _, err := w.Write(buf); err != nil {

0 commit comments

Comments
 (0)