MCPcopy
hub / github.com/perkeep/perkeep / DecodeJSON

Function DecodeJSON

internal/httputil/httputil.go:273–279  ·  view source on GitHub ↗

DecodeJSON decodes the JSON in res.Body into dest and then closes res.Body.

(res *http.Response, dest interface{})

Source from the content-addressed store, hash-verified

271// DecodeJSON decodes the JSON in res.Body into dest and then closes
272// res.Body.
273func DecodeJSON(res *http.Response, dest interface{}) error {
274 defer res.Body.Close()
275 if err := json.NewDecoder(res.Body).Decode(dest); err != nil {
276 return fmt.Errorf("httputil.DecodeJSON: %v", err)
277 }
278 return nil
279}
280
281func IsWebsocketUpgrade(req *http.Request) bool {
282 return req.Method == "GET" && req.Header.Get("Upgrade") == "websocket"

Callers 15

parseStatResponseFunction · 0.92
responseJSONMapMethod · 0.92
UploadMethod · 0.92
RemoveBlobsMethod · 0.92
GetRecentPermanodesMethod · 0.92
GetPermanodesWithAttrMethod · 0.92
DescribeMethod · 0.92
GetClaimsMethod · 0.92
QueryMethod · 0.92
versionMismatchMethod · 0.92
doDiscoveryMethod · 0.92

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected