(res *http.Response, obj interface{})
| 75 | } |
| 76 | |
| 77 | func DecodeJSON(res *http.Response, obj interface{}) error { |
| 78 | ctype := res.Header.Get("Content-Type") |
| 79 | if !(lfsMediaTypeRE.MatchString(ctype) || jsonMediaTypeRE.MatchString(ctype)) { |
| 80 | return &decodeTypeError{Type: ctype} |
| 81 | } |
| 82 | |
| 83 | err := json.NewDecoder(res.Body).Decode(obj) |
| 84 | res.Body.Close() |
| 85 | |
| 86 | if err != nil { |
| 87 | return errors.Wrap(err, tr.Tr.Get("Unable to parse HTTP response for %s %s", res.Request.Method, res.Request.URL)) |
| 88 | } |
| 89 | |
| 90 | return nil |
| 91 | } |
no test coverage detected