MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / getJSON

Function getJSON

data/scripts/examples/ai.js:72–83  ·  view source on GitHub ↗
(endpoint, path, cb)

Source from the content-addressed store, hash-verified

70}
71
72function getJSON(endpoint, path, cb) {
73 get(endpoint + path, function(rsp) {
74 var data, error = rsp.status != 200 ? 'status:' + rsp.status : 0;
75 try {
76 if (!error)
77 data = JSON.parse(rsp.string);
78 } catch (ex) {
79 error = ex;
80 }
81 cb(data, error);
82 });
83}
84
85function postJSON(endpoint, path, body, cb) {
86 post(endpoint + path, body, function(rsp) {

Callers

nothing calls this directly

Calls 2

parseMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected