diff --git a/internal/transport/transport.go b/internal/transport/transport.go index aaa62a7a..f9116cf4 100644 --- a/internal/transport/transport.go +++ b/internal/transport/transport.go @@ -307,12 +307,6 @@ func (s *Stream) Trailer() metadata.MD { return c } -// ServerTransport returns the underlying ServerTransport for the stream. -// The client side stream always returns nil. -func (s *Stream) ServerTransport() ServerTransport { - return s.st -} - // ContentSubtype returns the content-subtype for a request. For example, a // content-subtype of "proto" will result in a content-type of // "application/grpc+proto". This will always be lowercase. See @@ -359,8 +353,7 @@ func (s *Stream) SetHeader(md metadata.MD) error { // combined with any metadata set by previous calls to SetHeader and // then written to the transport stream. func (s *Stream) SendHeader(md metadata.MD) error { - t := s.ServerTransport() - return t.WriteHeader(s, md) + return s.st.WriteHeader(s, md) } // SetTrailer sets the trailer metadata which will be sent with the RPC status diff --git a/internal/transport/transport_test.go b/internal/transport/transport_test.go index deaeb8f1..cbf20386 100644 --- a/internal/transport/transport_test.go +++ b/internal/transport/transport_test.go @@ -140,9 +140,9 @@ func (h *testStreamHandler) handleStreamPingPong(t *testing.T, s *Stream) { } func (h *testStreamHandler) handleStreamMisbehave(t *testing.T, s *Stream) { - conn, ok := s.ServerTransport().(*http2Server) + conn, ok := s.st.(*http2Server) if !ok { - t.Fatalf("Failed to convert %v to *http2Server", s.ServerTransport()) + t.Fatalf("Failed to convert %v to *http2Server", s.st) } var sent int p := make([]byte, http2MaxFrameLen)