http

package
v0.0.0-...-f9573de Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = http.DefaultClient

DefaultClient holds a default HTTP client

The client can be customised per-request by passing one in as the argument to Call

View Source
var DefaultForwardHeaders = []string{
	"X-Forwarded-For", "X-Forwarded-Proto",
	"X-Forwarded-Host", "X-Request-Id",
}

DefaultForwardHeaders is a slice of default header names which are forwarded from the incoming request.

Forwarded headers can be customised per-request using Requester.ForwardHeaders

Functions

func Unmarshal

func Unmarshal(req *http.Request, dest interface{}) (body []byte, err error)

Unmarshal unmarhals a http request body to dest

Types

type AuthHeader

type AuthHeader interface {
	String() string
}

AuthHeader ...

type BasicService

type BasicService string

BasicService is a Service which has only a URL

func (BasicService) Call

func (bs BasicService) Call(args ...interface{}) Requester

Call ...

func (BasicService) URL

func (bs BasicService) URL() string

URL returns the service URL

type Caller

type Caller interface {
	Call(...interface{}) Requester
}

Caller ...

type Headers

type Headers map[string]string

Headers ...

type Key

type Key string

Key is a type alias for a string containing an API key

func (Key) String

func (k Key) String() string

type Plain

type Plain string

Plain is a type alias for a string containing a plain Auth header

func (Plain) String

func (p Plain) String() string

type Requester

type Requester interface {
	ForwardHeaders(...string) Requester

	Delete(string) Resulter
	Get(string) Resulter
	Head(string) Resulter
	Options(string) Resulter
	Patch(string) Resulter
	Post(string) Resulter
	Put(string) Resulter
	Trace(string) Resulter
}

Requester ...

type Resulter

type Resulter interface {
	Do() (*http.Response, error)
	Result(dest interface{}) (*http.Response, []byte, error)
	Stream(delim byte, c chan StreamResulter) (*http.Response, error)
}

Resulter ...

type Service

type Service interface {
	URL() string
}

Service represents a HTTP service

type StreamResulter

type StreamResulter interface {
	Bytes() []byte
	Error() error
	Result(dest interface{}) ([]byte, error)
}

StreamResulter ...

type Token

type Token string

Token is a type alias for a string containing an OAuth2 token

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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