rpc/encode/selector.go
crusader 8e43174376 ing
2017-10-31 18:25:44 +09:00

26 lines
650 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 {
SelectByReader(r io.Reader) Encoder
SelectByWriter(w io.Writer) Encoder
}
type encoderSelector struct {
}
func (_ *encoderSelector) SelectByReader(_ io.Reader) Encoder {
return DefaultEncoder
}
func (_ *encoderSelector) SelectByWriter(_ io.Writer) Encoder {
return DefaultEncoder
}
var DefaultEncoderSelector = &encoderSelector{}