Codebase list golang-github-go-kit-kit / 75666f7 transport / codec / codec.go
75666f7

Tree @75666f7 (Download .tar.gz)

codec.go @75666f7raw · history · blame

package codec

import (
	"io"

	"golang.org/x/net/context"

	"github.com/go-kit/kit/server"
)

// Codec defines how to decode and encode requests and responses. Decode takes
// and returns a context because the request may be accompanied by information
// that needs to be applied there.
type Codec interface {
	Decode(context.Context, io.Reader, server.Request) (context.Context, error)
	Encode(io.Writer, server.Response) error
}