Documentation ¶
Overview ¶
Helper package to handle drudgery of REST request handling
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHeaders ¶
func AddJSONMimeType ¶
func AddJSONMimeType() func(*Request)
func AllowSelfSignedCerts ¶
func AllowSelfSignedCerts() func(*Request)
Types ¶
type Response ¶
func Get ¶
Get sends a HTTP GET request to the provided url. options are run prior to the request being sent
addAuth := func(r *Request) { r.SetBasicAuth("username", "password") } resp, err := requests.Get("http://ilo.com/redfish", addAuth) if err != nil { panic(err) } fmt.Println(resp.StatusCode)
func Post ¶
Post sends a HTTP POST request to the provided url. and option should be include to set the correct content-type header
addMimeType := func(r *Request) { r.Header.Add("content-type", "application/json") }
resp, err := requests.Post("https://ilo.com/login", buf, redirect)
if err != nil { panic(err) }
fmt.Println(resp.JSON())
func (*Response) Unmarshall ¶
Unmarshall expected json response into passed interface type
Click to show internal directories.
Click to hide internal directories.