tryBufferFromReader attempts to cast the reader to a `*bytes.Buffer` this is possible when using httpgrpc. If it fails it will return nil and false.
(reader io.Reader)
| 261 | // tryBufferFromReader attempts to cast the reader to a `*bytes.Buffer` this is possible when using httpgrpc. |
| 262 | // If it fails it will return nil and false. |
| 263 | func tryBufferFromReader(reader io.Reader) (*bytes.Buffer, bool) { |
| 264 | if bufReader, ok := reader.(interface { |
| 265 | BytesBuffer() *bytes.Buffer |
| 266 | }); ok && bufReader != nil { |
| 267 | return bufReader.BytesBuffer(), true |
| 268 | } |
| 269 | return nil, false |
| 270 | } |
| 271 | |
| 272 | // SerializeProtoResponse serializes a protobuf response into an HTTP response. |
| 273 | func SerializeProtoResponse(w http.ResponseWriter, resp proto.Message, compression CompressionType) error { |
no test coverage detected