xrequests

package
v0.0.0-...-89edfd8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POST    = "POST"
	GET     = "GET"
	HEAD    = "HEAD"
	PUT     = "PUT"
	DELETE  = "DELETE"
	PATCH   = "PATCH"
	OPTIONS = "OPTIONS"
)
View Source
const (
	TypeJSON       = "json"
	TypeXML        = "xml"
	TypeUrlencoded = "urlencoded"
	TypeForm       = "form"
	TypeFormData   = "form-data"
	TypeHTML       = "html"
	TypeText       = "text"
	TypeMultipart  = "multipart"
)

Variables

View Source
var DisableTransportSwap bool
View Source
var Types = map[string]string{
	TypeJSON:       "application/json",
	TypeXML:        "application/xml",
	TypeForm:       "application/x-www-form-urlencoded",
	TypeFormData:   "application/x-www-form-urlencoded",
	TypeUrlencoded: "application/x-www-form-urlencoded",
	TypeHTML:       "text/html",
	TypeText:       "text/plain",
	TypeMultipart:  "multipart/form-data",
}

Functions

This section is empty.

Types

type Agent

type Agent struct {
	BasicAuth         struct{ Username, Password string }
	BounceToRawString bool
	ClearAgentData    bool
	ClearSendData     bool
	Client            *http.Client
	Cookies           []*http.Cookie
	Data              map[string]interface{}
	Debug             bool
	Errors            []error
	FileData          []File
	ForceType         string
	FormData          url.Values
	Header            http.Header
	Method            string
	QueryData         url.Values
	RawString         string
	Retryer           *RetryType
	SliceData         []interface{}
	TargetType        string
	Transport         *http.Transport
	URL               string
}

func New

func New() *Agent

func (*Agent) AddBearer

func (a *Agent) AddBearer(token string) *Agent

func (*Agent) AddCookie

func (a *Agent) AddCookie(c *http.Cookie) *Agent

func (*Agent) AddCookies

func (a *Agent) AddCookies(c []*http.Cookie) *Agent

func (*Agent) AppendHeader

func (a *Agent) AppendHeader(param, value string) *Agent

func (*Agent) ClearAgent

func (a *Agent) ClearAgent()

func (*Agent) ClearSendDataNow

func (a *Agent) ClearSendDataNow() *Agent

func (*Agent) Delete

func (a *Agent) Delete(url string) *Agent

func (*Agent) End

func (a *Agent) End(callback ...func(response Response, body string, errs []error)) (Response, string, []error)

func (*Agent) EndBytes

func (a *Agent) EndBytes(callback ...func(response Response, body []byte, errs []error)) (Response, []byte, []error)

func (*Agent) EndStruct

func (a *Agent) EndStruct(v interface{}, callback ...func(response Response, v interface{}, body []byte, errs []error)) (Response, []byte, []error)

func (*Agent) Get

func (a *Agent) Get(url string) *Agent

func (*Agent) Head

func (a *Agent) Head(url string) *Agent

func (*Agent) IgnoreTLSCheck

func (a *Agent) IgnoreTLSCheck() *Agent

func (*Agent) MakeRequest

func (a *Agent) MakeRequest() (*http.Request, error)

func (*Agent) Options

func (a *Agent) Options(url string) *Agent

func (*Agent) Param

func (a *Agent) Param(key, value string) *Agent

func (*Agent) Patch

func (a *Agent) Patch(url string) *Agent

func (*Agent) Post

func (a *Agent) Post(url string) *Agent

func (*Agent) ProcessReflectPointer

func (a *Agent) ProcessReflectPointer(v reflect.Value, filename string, fieldname string, args []string) *Agent

func (*Agent) Proxy

func (a *Agent) Proxy(proxyurl string) *Agent

func (*Agent) Put

func (a *Agent) Put(url string) *Agent

func (*Agent) Query

func (a *Agent) Query(content interface{}) *Agent

func (*Agent) Retry

func (a *Agent) Retry(count int, rTime time.Duration, codes ...int) *Agent

func (*Agent) Send

func (a *Agent) Send(content interface{}) *Agent

func (*Agent) SendFile

func (a *Agent) SendFile(file interface{}, args ...string) *Agent

func (*Agent) SendMap

func (a *Agent) SendMap(content interface{}) *Agent

func (*Agent) SendRawBody

func (a *Agent) SendRawBody() *Agent

func (*Agent) SendSlice

func (a *Agent) SendSlice(content []interface{}) *Agent

func (*Agent) SendString

func (a *Agent) SendString(content interface{}) *Agent

func (*Agent) SendStruct

func (a *Agent) SendStruct(content interface{}) *Agent

func (*Agent) SetBasicAuth

func (a *Agent) SetBasicAuth(username, password string) *Agent

func (*Agent) SetClearSendDataBetweenSessions

func (a *Agent) SetClearSendDataBetweenSessions() *Agent

func (*Agent) SetDebug

func (a *Agent) SetDebug(enabled bool) *Agent

func (*Agent) SetDoNotClearBetweenSessions

func (a *Agent) SetDoNotClearBetweenSessions() *Agent

func (*Agent) SetHeader

func (a *Agent) SetHeader(param, value string) *Agent

func (*Agent) TLSClientConfig

func (a *Agent) TLSClientConfig(config *tls.Config) *Agent

func (*Agent) Timeout

func (a *Agent) Timeout(timeout time.Duration) *Agent

func (*Agent) Type

func (a *Agent) Type(str string) *Agent

type File

type File struct {
	Filename  string
	Fieldname string
	Data      []byte
}

type Request

type Request *http.Request

type Response

type Response *http.Response

type RetryType

type RetryType struct {
	RetryStatus []int
	RetryTime   time.Duration
	RetryCount  int
	Attempt     int
	Enable      bool
}

Jump to

Keyboard shortcuts

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