SetHeader sets the header metadata. This can be called multiple times. This should not be called in parallel to other data writes.
(md metadata.MD)
| 152 | // SetHeader sets the header metadata. This can be called multiple times. |
| 153 | // This should not be called in parallel to other data writes. |
| 154 | func (s *ServerStream) SetHeader(md metadata.MD) error { |
| 155 | if md.Len() == 0 { |
| 156 | return nil |
| 157 | } |
| 158 | if s.isHeaderSent() || s.getState() == streamDone { |
| 159 | return ErrIllegalHeaderWrite |
| 160 | } |
| 161 | s.hdrMu.Lock() |
| 162 | s.header = metadata.Join(s.header, md) |
| 163 | s.hdrMu.Unlock() |
| 164 | return nil |
| 165 | } |
| 166 | |
| 167 | // SetTrailer sets the trailer metadata which will be sent with the RPC status |
| 168 | // by the server. This can be called multiple times. |
nothing calls this directly
no test coverage detected