rpc/encode/selector.go
crusader 0c7808f8e3 ing
2017-10-26 16:21:35 +09:00

21 lines
507 B
Go

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{}