request

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(string, ...Parameter) (*Response, error)
}

type ClientImplementation

type ClientImplementation struct {
	HTTPClient *http.Client
}

func (*ClientImplementation) Perform

func (c *ClientImplementation) Perform(method, url string, params ...Parameter) (*Response, error)

type MockClient

type MockClient struct {
	Client

	Method     chan string
	URL        chan string
	Parameters chan []Parameter

	OutResponse chan *Response
	OutError    error
}

func NewMockClient

func NewMockClient(l int) *MockClient

func (*MockClient) Perform

func (mc *MockClient) Perform(method, url string, params ...Parameter) (*Response, error)

type Parameter

type Parameter func(*Request)

Parameter is an optional argument expected by the request API

func Header(key string, values ...string) Parameter

type Request

type Request struct {
	Method, URL string

	Headers http.Header
}

func (*Request) Normalize

func (r *Request) Normalize() *http.Request

Normalize converts request.Request to http.Request Currently request pkg is a wrapper for http pkg

type Response

type Response struct {
	*http.Response
}

func Delete

func Delete(url string, params ...Parameter) (*Response, error)

func Get

func Get(url string, params ...Parameter) (*Response, error)
func Head(url string, params ...Parameter) (*Response, error)

func Options

func Options(url string, params ...Parameter) (*Response, error)

func Post

func Post(url string, params ...Parameter) (*Response, error)

func Put

func Put(url string, params ...Parameter) (*Response, error)

func (*Response) JSON

func (r *Response) JSON(f interface{}) error

func (*Response) Text

func (r *Response) Text() ([]byte, error)

Jump to

Keyboard shortcuts

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