httpclient

package
v0.0.0-...-8488f5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2016 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResumingStream

func ResumingStream(connect func(int64) (*http.Response, error, bool), outputCh interface{}) (stream.Stream, error)

func Stream

func Stream(res *http.Response, outputCh interface{}) stream.Stream

Stream manufactures a `pkg/stream.Stream`, starts a worker pumping events out of decoding, and returns that.

The 'outputCh' parameter must be a sendable channel. The "zero"-values of channel's content type will be created and used in the deserialization, then sent.

The return values from `httpclient.RawReq` are probably a useful starting point for the 'res' parameter.

Closing the returned `stream.Stream` shuts down the worker.

func ToJSON

func ToJSON(v interface{}) (io.Reader, error)

Types

type Client

type Client struct {
	ErrNotFound error
	URL         string
	Key         string
	Host        string
	HTTP        *http.Client
	HijackDial  DialFunc
}

func (*Client) Delete

func (c *Client) Delete(path string) error

func (*Client) Get

func (c *Client) Get(path string, out interface{}) error

func (*Client) Hijack

func (c *Client) Hijack(method, path string, header http.Header, in interface{}) (ReadWriteCloser, error)

func (*Client) Post

func (c *Client) Post(path string, in, out interface{}) error

func (*Client) Put

func (c *Client) Put(path string, in, out interface{}) error

func (*Client) RawReq

func (c *Client) RawReq(method, path string, header http.Header, in, out interface{}) (*http.Response, error)

func (*Client) RawReqWithHTTP

func (c *Client) RawReqWithHTTP(method, path string, header http.Header, in, out interface{}, client *http.Client) (*http.Response, error)

func (*Client) ResumingStream

func (c *Client) ResumingStream(method, path string, ch interface{}) (stream.Stream, error)

func (*Client) Send

func (c *Client) Send(method, path string, in, out interface{}) error

func (*Client) Stream

func (c *Client) Stream(method, path string, in, out interface{}) (stream.Stream, error)

Stream returns a stream.Stream for a specific method and path. in is an optional json object to be sent to the server via the body, and out is a required channel, to which the output will be streamed.

func (*Client) StreamWithHeader

func (c *Client) StreamWithHeader(method, path string, header http.Header, in, out interface{}) (stream.Stream, error)

type DialFunc

type DialFunc func(network, addr string) (net.Conn, error)

type ReadWriteCloser

type ReadWriteCloser interface {
	io.ReadWriteCloser
	CloseWrite() error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL