Documentation ¶
Index ¶
- func DeleteJSON(ctx context.Context, url string, headers map[string]string, req interface{}, ...) error
- func DeleteXML(ctx context.Context, url string, headers map[string]string, req interface{}, ...) error
- func GetBasicAuth(r *http.Request) (username, password string)
- func GetBodyJSON(r *http.Request, v interface{}) error
- func GetBodyXML(r *http.Request, v interface{}) error
- func GetJSON(ctx context.Context, url string, headers map[string]string, res interface{}) error
- func GetParam(r *http.Request, name string) string
- func GetParamBool(r *http.Request, name string) bool
- func GetParamInt(r *http.Request, name string) (int, error)
- func GetXML(ctx context.Context, url string, headers map[string]string, res interface{}) error
- func PostJSON(ctx context.Context, url string, headers map[string]string, req interface{}, ...) error
- func PostXML(ctx context.Context, url string, headers map[string]string, req interface{}, ...) error
- func PutJSON(ctx context.Context, url string, headers map[string]string, req interface{}, ...) error
- func PutXML(ctx context.Context, url string, headers map[string]string, req interface{}, ...) error
- func Request(ctx context.Context, method, url string, headers map[string]string, ...) (*http.Response, error)
- func RequestJSON(ctx context.Context, method, url string, headers map[string]string, ...) (err error)
- func RequestXML(ctx context.Context, method, url string, headers map[string]string, ...) (err error)
- type HTTPUtil
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteJSON ¶
func DeleteJSON(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error
DeleteJSON ...
func DeleteXML ¶
func DeleteXML(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error
DeleteXML ...
func GetBasicAuth ¶
GetBasicAuth returns basic auth info
func GetBodyJSON ¶
GetBodyJSON returns the post json body
func GetBodyXML ¶
GetBodyXML returns the post xml body
func GetParamBool ¶
GetParamBool returns url parameter as boolean
func PostJSON ¶
func PostJSON(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error
PostJSON ...
func PostXML ¶
func PostXML(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error
PostXML ...
func PutJSON ¶
func PutJSON(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error
PutJSON ...
func PutXML ¶
func PutXML(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error
PutXML ...
func Request ¶
func Request(ctx context.Context, method, url string, headers map[string]string, body io.Reader) (*http.Response, error)
Request ...
Types ¶
type HTTPUtil ¶ added in v0.1.2
type HTTPUtil interface { // GetParam returns url parameter as string GetParam(r *http.Request, name string) string // GetParamBool returns url parameter as boolean GetParamBool(r *http.Request, name string) bool // GetParamInt ... GetParamInt(r *http.Request, name string) (int, error) // GetBodyJSON returns the post json body GetBodyJSON(r *http.Request, v interface{}) error // GetBodyXML returns the post xml body GetBodyXML(r *http.Request, v interface{}) error // GetBasicAuth returns basic auth info GetBasicAuth(r *http.Request) (username, password string) // Request ... Request(ctx context.Context, method, url string, headers map[string]string, body io.Reader) (*http.Response, error) // RequestJSON ... RequestJSON(ctx context.Context, method, url string, headers map[string]string, req interface{}, res interface{}) (err error) // GetJSON ... GetJSON(ctx context.Context, url string, headers map[string]string, res interface{}) error // PostJSON ... PostJSON(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error // PutJSON ... PutJSON(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error // DeleteJSON ... DeleteJSON(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error // RequestXML ... RequestXML(ctx context.Context, method, url string, headers map[string]string, req interface{}, res interface{}) (err error) // GetXML ... GetXML(ctx context.Context, url string, headers map[string]string, res interface{}) error // PostXML ... PostXML(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error // PutXML ... PutXML(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error // DeleteXML ... DeleteXML(ctx context.Context, url string, headers map[string]string, req interface{}, res interface{}) error }
HTTPUtil interface
var Default HTTPUtil = &httputil{}
Default default single for http utility
Click to show internal directories.
Click to hide internal directories.