transport

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 25 Imported by: 0

README

transport

GoDoc

Client for HTTP request

Dependencies
- golang.org/x/text
- golang.org/x/net
Install
go get gopkg.in/webnice/transport.v1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentInterface

type ContentInterface interface {
	Transcode(encoding.Encoding) ContentInterface
	Transform(TransformFunc) ContentInterface
	String() (string, error)
	Bytes() ([]byte, error)
	ReaderCloser() (io.ReadCloser, error)
	Write(io.Writer) error
	ContentUnmarshalJSON(interface{}) error
	ContentUnmarshalXML(interface{}) error
	Untar() ContentInterface
	Unzip() ContentInterface
	UnGzip() ContentInterface
}

ContentInterface is an contentImplementation interface

type HeaderInterface

type HeaderInterface interface {
	Add(string, string)
	Del(string)
	Get(string) string
	Set(string, string)
	Names() []string
}

HeaderInterface is an requestHeadersImplementation interface

type Request

type Request interface {
	Accept(string) Request
	AcceptEncoding(string) Request
	AcceptLanguage(string) Request
	Auth(string, string) Request
	ContentType(string) Request
	Cookies([]*http.Cookie) Request
	DataString(string) Request
	DataBytes([]byte) Request
	Data(*bytes.Reader) Request
	Method(methods.Value) Request
	ProxyURL(string) Request
	Referer(string) Request
	TimeOut(time.Duration) Request
	UserAgent(string) Request
	URL(string) Request
	Response(io.Writer) Request
	TLSVerifyOn() Request
	TLSVerifyOff() Request

	ClientSource() (*http.Client, error)
	RequestSource() (*http.Request, error)
	Do() (Response, error)
	Error() (Request, error)
	Header() HeaderInterface
}

Request is an request interface

type Response

type Response interface {
	Content() ContentInterface
	ContentLength() int64
	Cookies() []*http.Cookie
	Error() error
	Header() HeaderInterface
	Latency() time.Duration
	LatencyData() time.Duration
	Response() *http.Response
	StatusCode() int
	Status() string
	Charmap() charmap.Charmap
}

Response is an response result interface

type TransformFunc

type TransformFunc func(io.Reader) (io.Reader, error)

TransformFunc is an func for streaming content conversion

type Transport

type Transport interface {
	Method() methods.Interface
	NewRequest(method methods.Value) Request
}

Transport is an interface

func NewTransport

func NewTransport() Transport

NewTransport Function create new transport implementation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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