Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func URL ¶
URL returns base, endpoint, and params encoded into a single url string with query paramters.
It uses net/url to parse base; expect mirrored error conditions. It uses path for endpoint normalization; expect the mirrored effects. It uses go-querystring for parameter values; expect mirrored error conditions.
Types ¶
type Codec ¶
type Codec interface {
Marshal(any) ([]byte, error)
Unmarshal([]byte, any) error
ContentType() string
}
Codec is the interface implemented by any object that encodes and decodes to and from a specific content type.
type JSONCodec ¶
type JSONCodec struct{}
JSONCodec implements a JSON codec.
func (JSONCodec) ContentType ¶
type Option ¶
type Option func(*Pipe)
Option is a function that sets a Pipe option.
func WithClient ¶
WithClient sets Pipe to funnel through client.
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
Pipe funnels HTTP requests using an http.Client and a Codec.
func New ¶
New returns a new Pipe configured with the given options. If no options are supplied, JSONCodec and http.DefaultClient are used.