MCPcopy
hub / github.com/git-lfs/git-lfs / DecodeJSON

Function DecodeJSON

lfshttp/lfshttp.go:77–91  ·  view source on GitHub ↗
(res *http.Response, obj interface{})

Source from the content-addressed store, hash-verified

75}
76
77func 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}

Callers 6

LockMethod · 0.92
UnlockMethod · 0.92
SearchMethod · 0.92
SearchVerifiableMethod · 0.92
BatchMethod · 0.92
handleResponseMethod · 0.85

Calls 3

WrapFunction · 0.92
GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected