Skip to content

Commit

Permalink
Rename ReceivedHeader -> {Request,Response}Header
Browse files Browse the repository at this point in the history
Especially on user-facing types, use the familar request/response
terminology instead of sender/receiver.

See #53.
  • Loading branch information
akshayjshah committed Jan 28, 2022
1 parent 31b73d7 commit fbf82c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions client_duplex_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ Receiver = (*clientReceiver)(nil)
func (cr *clientReceiver) Receive(m any) error { return cr.stream.Receive(m) }
func (cr *clientReceiver) Close() error { return cr.stream.CloseReceive() }
func (cr *clientReceiver) Spec() Specification { return cr.stream.Spec() }
func (cr *clientReceiver) Header() http.Header { return cr.stream.ReceivedHeader() }
func (cr *clientReceiver) Header() http.Header { return cr.stream.ResponseHeader() }

// clientStream represents a bidirectional exchange of protobuf messages
// between the client and server. The request body is the stream from client to
Expand Down Expand Up @@ -186,7 +186,7 @@ func (cs *clientStream) CloseReceive() error {
return nil
}

func (cs *clientStream) ReceivedHeader() http.Header {
func (cs *clientStream) ResponseHeader() http.Header {
<-cs.responseReady
return cs.response.Header
}
Expand Down
8 changes: 4 additions & 4 deletions clientstream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ func (s *Server[Res]) Receive() (*Res, error) {
return &res, nil
}

// ReceivedHeader returns the headers received from the server. It blocks until
// ResponseHeader returns the headers received from the server. It blocks until
// the first call to Receive returns.
func (s *Server[Res]) ReceivedHeader() http.Header {
func (s *Server[Res]) ResponseHeader() http.Header {
return s.receiver.Header()
}

Expand Down Expand Up @@ -122,8 +122,8 @@ func (b *Bidirectional[Req, Res]) CloseReceive() error {
return b.receiver.Close()
}

// ReceivedHeader returns the headers received from the server. It blocks until
// ResponseHeader returns the headers received from the server. It blocks until
// the first call to Receive returns.
func (b *Bidirectional[Req, Res]) ReceivedHeader() http.Header {
func (b *Bidirectional[Req, Res]) ResponseHeader() http.Header {
return b.receiver.Header()
}
8 changes: 4 additions & 4 deletions handlerstream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func NewClient[Req, Res any](s rerpc.Sender, r rerpc.Receiver) *Client[Req, Res]
return &Client[Req, Res]{sender: s, receiver: r}
}

// ReceivedHeader returns the headers received from the client.
func (c *Client[Req, Res]) ReceivedHeader() http.Header {
// RequestHeader returns the headers received from the client.
func (c *Client[Req, Res]) RequestHeader() http.Header {
return c.receiver.Header()
}

Expand Down Expand Up @@ -80,8 +80,8 @@ func NewBidirectional[Req, Res any](s rerpc.Sender, r rerpc.Receiver) *Bidirecti
return &Bidirectional[Req, Res]{sender: s, receiver: r}
}

// ReceivedHeader returns the headers received from the client.
func (b *Bidirectional[Req, Res]) ReceivedHeader() http.Header {
// RequestHeader returns the headers received from the client.
func (b *Bidirectional[Req, Res]) RequestHeader() http.Header {
return b.receiver.Header()
}

Expand Down

0 comments on commit fbf82c7

Please sign in to comment.