2017-10-26 07:21:35 +00:00
|
|
|
package encode
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
2017-10-31 09:25:44 +00:00
|
|
|
// Encoder interface contains the encoder for response.
|
2017-10-26 07:21:35 +00:00
|
|
|
// Eg. gzip, flate compressions.
|
|
|
|
type Encoder interface {
|
|
|
|
Encode(w io.Writer) io.Writer
|
2017-10-31 09:25:44 +00:00
|
|
|
Decode(r io.Reader) io.Reader
|
2017-10-26 07:21:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type encoder struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (_ *encoder) Encode(w io.Writer) io.Writer {
|
|
|
|
return w
|
|
|
|
}
|
|
|
|
|
2017-10-31 09:25:44 +00:00
|
|
|
func (_ *encoder) Decode(r io.Reader) io.Reader {
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
2017-10-26 07:21:35 +00:00
|
|
|
var DefaultEncoder = &encoder{}
|