git.iko.soy/typeable/oauth2-proxy
on master help sign in
Add comments to exported methods for api package
commita65ceb2c41800aa85aa837fa56c80ef66ad8b820 authorJoel Speed <Joel.speed@hotmail.co.uk> dateThu 20 Dec 2018, 09:37 (8 years ago) parentee913fb
1 file changed+3
api/api.go+3
api/api.go+3
@@ -10,6 +10,7 @@ import (
1010 "github.com/bitly/go-simplejson"
1111)
1212
13+// Request parses the request body into a simplejson.Json object
1314func Request(req *http.Request) (*simplejson.Json, error) {
1415 resp, err := http.DefaultClient.Do(req)
1516 if err != nil {
@@ -32,6 +33,7 @@ func Request(req *http.Request) (*simplejson.Json, error) {
3233 return data, nil
3334}
3435
36+// RequestJSON parses the request body into the given interface
3537func RequestJSON(req *http.Request, v interface{}) error {
3638 resp, err := http.DefaultClient.Do(req)
3739 if err != nil {
@@ -50,6 +52,7 @@ func RequestJSON(req *http.Request, v interface{}) error {
5052 return json.Unmarshal(body, v)
5153}
5254
55+// RequestUnparsedResponse performs a GET and returns the raw response object
5356func RequestUnparsedResponse(url string, header http.Header) (resp *http.Response, err error) {
5457 req, err := http.NewRequest("GET", url, nil)
5558 if err != nil {