Documentation ¶
Overview ¶
Package httpreq provides general utilities for around net/http requests for a simpler API and extra utilities for parsing JSON request and response boddies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Response ¶
Response extends http.Response with some extra utility functions.
func Request ¶
func Request(method, url string, headers map[string]string, data interface{}) (res *Response, err error)
Request executes a HTTP request with the given method to the given URL and attaches the passed headers. When data is passed, the object will be serialized using JSON encoder and attached to the request body.
func (*Response) JSON ¶
JSON parses the response body data to the passed object reference using JSON decoder and returns errors occured.
func (*Response) Release ¶
func (r *Response) Release()
Release releases the request instance back to the request object pool.
func (*Response) ResetState ¶
func (r *Response) ResetState()
Click to show internal directories.
Click to hide internal directories.