Skip to content

Commit a81d9c7

Browse files
authored
don't encode error if the response has been committed (#345)
1 parent fef3216 commit a81d9c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

transport/handlers.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ func NewUnaryHandler(e endpoint.Endpoint, dec decodeRequestFunc, enc encodeRespo
3737
}
3838

3939
if err := enc(ctx, w, resp); err != nil {
40-
return errorEncoder(c, err)
40+
if !c.Response().Committed {
41+
return errorEncoder(c, err)
42+
}
43+
l.Error("response headers already written", "err", err)
4144
}
4245
return nil
4346
}

0 commit comments

Comments
 (0)