Documentation ¶
Index ¶
- func ParseBody(body io.ReadCloser, dest any) error
- func ParseResponse(response *http.Response, dest any) (err error)
- func ProcessResponse(w http.ResponseWriter, resp interface{}, ctx context.Context, err error)
- func ReadBody(body io.ReadCloser) []byte
- type Request
- func (r *Request) Delete(url string, headers map[string]string, params, dest interface{}) (resp *Response, err error)
- func (r *Request) Get(url string, headers map[string]string, dest interface{}) (resp *Response, err error)
- func (r *Request) Post(url string, headers map[string]string, params, dest interface{}) (resp *Response, err error)
- func (r *Request) Put(url string, headers map[string]string, params, dest interface{}) (resp *Response, err error)
- func (r *Request) Request(method, urlAddress string, headers map[string]string, params, dest interface{}) (resp *Response, err error)
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseResponse ¶
ParseResponse ParseRequest read a body of response and try to Unmarshal into a struct passed by parameter
func ProcessResponse ¶
func ProcessResponse(w http.ResponseWriter, resp interface{}, ctx context.Context, err error)
ProcessResponse Helper function to return a http response, performing some common checking
func ReadBody ¶
func ReadBody(body io.ReadCloser) []byte
Types ¶
type Request ¶
type Request struct { BasicAuthentication struct { UserName, Password string } Timeout time.Duration }
func NewRequest ¶
func NewRequest() Request
func (*Request) Get ¶
func (r *Request) Get(url string, headers map[string]string, dest interface{}) (resp *Response, err error)
Get realiza uma request GET e joga o resultado da request para a variavel dest
func (*Request) Post ¶
func (r *Request) Post(url string, headers map[string]string, params, dest interface{}) (resp *Response, err error)
Post realiza uma request POST e joga o resultado da request para a variavel dest
Click to show internal directories.
Click to hide internal directories.