rpc/encode/selector.go

21 lines
507 B
Go
Raw Normal View History

2017-10-26 07:21:35 +00:00
package encode
import "io"
// EncoderSelector interface provides a way to select encoder using the http
// request. Typically people can use this to check HEADER of the request and
// figure out client capabilities.
// Eg. "Accept-Encoding" tells about supported compressions.
type EncoderSelector interface {
Select(r io.Reader) Encoder
}
type encoderSelector struct {
}
func (_ *encoderSelector) Select(_ io.Reader) Encoder {
return DefaultEncoder
}
var DefaultEncoderSelector = &encoderSelector{}