Documentation ¶
Index ¶
- type BodyProvider
- type BodyResponse
- type Requist
- func (r *Requist) AddHeader(key, value string) *Requist
- func (r *Requist) AddQueryParam(key, value string) *Requist
- func (r *Requist) Base(base string) *Requist
- func (r *Requist) Body(body io.Reader) *Requist
- func (r *Requist) BodyAsForm(body interface{}) *Requist
- func (r *Requist) BodyAsJSON(body interface{}) *Requist
- func (r *Requist) BodyProvider(body BodyProvider) *Requist
- func (r *Requist) Connect(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) DelHeader(key, value string) *Requist
- func (r *Requist) DelQueryParam(key, value string) *Requist
- func (r *Requist) Delete(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) Get(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) GetBasicAuth() string
- func (r *Requist) Head(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) Method(method string) *Requist
- func (r *Requist) New(baseURL string) *Requist
- func (r *Requist) Options(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) Patch(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) Path(path string) *Requist
- func (r *Requist) Post(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) Put(path string, successV, failureV interface{}) (*Requist, error)
- func (r *Requist) Request(successV, failureV interface{}) (*Requist, error)
- func (r *Requist) SetBasicAuth(username, password string) *Requist
- func (r *Requist) SetHeader(key, value string) *Requist
- func (r *Requist) SetQueryParam(key, value string) *Requist
- func (r *Requist) StatusCode() int
- func (r *Requist) Trace(path string, successV, failureV interface{}) (*Requist, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyProvider ¶
type BodyProvider interface { // ContentType returns the Content-Type of the body. ContentType() string // Body returns the io.Reader body. Body() (io.Reader, error) }
BodyProvider provides Body content for http.Request attachment.
type BodyResponse ¶
type BodyResponse interface { // Decode decodes the response into the value pointed to by v. Decode(resp io.Reader, v interface{}) error }
BodyResponse decodes http responses into struct values.
type Requist ¶
type Requist struct {
// contains filtered or unexported fields
}
Requist struct Encapsulate an HTTP(S) requests builder and sender
func (*Requist) AddHeader ¶
Add adds the key, value pair in Headers, appending values for existing keys to the key's values. Header keys are canonicalized.
func (*Requist) AddQueryParam ¶
AddQueryParam adds the key, value tuples in QueryParams, appending values for existing keys
func (*Requist) BodyAsForm ¶
BodyAsForm sets the Requests's body from a formProvider
func (*Requist) BodyAsJSON ¶
BodyAsJSON sets the Requests's body from a jsonProvider
func (*Requist) BodyProvider ¶
func (r *Requist) BodyProvider(body BodyProvider) *Requist
BodyProvider sets the Requests's body provider from original BodyProvider interface{}.
func (*Requist) DelQueryParam ¶
Remove the key, value pair in QueryParams
func (*Requist) GetBasicAuth ¶
GetBasicAuth return the auth stored at the Requist class
func (*Requist) New ¶
New class function
@param Requist class pointer, previous existing instance @return Requist class pointer who clone some data from passed class
func (*Requist) SetBasicAuth ¶
SetBasicAuth sets the Authorization header to use HTTP Basic Authentication
func (*Requist) SetHeader ¶
Set sets the key, value pair in Headers, replacing existing values associated with key. Header keys are canonicalized.
func (*Requist) SetQueryParam ¶
SetQueryParam set the key, value tuples in params to
func (*Requist) StatusCode ¶
StatusCode return the HTTP StatusCode from last request