10 "github.com/bitly/go-simplejson"
13func Request(req *http.Request) (*simplejson.Json, error) {
14 resp, err := http.DefaultClient.Do(req)
16 log.Printf("%s %s %s", req.Method, req.URL, err)
19 body, err := ioutil.ReadAll(resp.Body)
21 log.Printf("%d %s %s %s", resp.StatusCode, req.Method, req.URL, body)
25 if resp.StatusCode != 200 {
26 return nil, fmt.Errorf("got %d %s", resp.StatusCode, body)
28 data, err := simplejson.NewJson(body)
35func RequestJson(req *http.Request, v interface{}) error {
36 resp, err := http.DefaultClient.Do(req)
38 log.Printf("%s %s %s", req.Method, req.URL, err)
41 body, err := ioutil.ReadAll(resp.Body)
43 log.Printf("%d %s %s %s", resp.StatusCode, req.Method, req.URL, body)
47 if resp.StatusCode != 200 {
48 return fmt.Errorf("got %d %s", resp.StatusCode, body)
50 return json.Unmarshal(body, v)
53func RequestUnparsedResponse(url string, header http.Header) (resp *http.Response, err error) {
54 req, err := http.NewRequest("GET", url, nil)
60 return http.DefaultClient.Do(req)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list