MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / parse

Method parse

src/rpc/server.cpp:352–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352void JSONRPCRequest::parse(const UniValue& valRequest)
353{
354 // Parse request
355 if (!valRequest.isObject())
356 throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object");
357 const UniValue& request = valRequest.get_obj();
358
359 // Parse id now so errors from here on will have the id
360 id = find_value(request, "id");
361
362 // Parse method
363 UniValue valMethod = find_value(request, "method");
364 if (valMethod.isNull())
365 throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
366 if (!valMethod.isStr())
367 throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string");
368 strMethod = valMethod.get_str();
369 if (fLogIPs)
370 LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s peeraddr=%s\n", SanitizeString(strMethod),
371 this->authUser, this->peerAddr);
372 else
373 LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser);
374
375 // Parse params
376 UniValue valParams = find_value(request, "params");
377 if (valParams.isArray() || valParams.isObject())
378 params = valParams;
379 else if (valParams.isNull())
380 params = UniValue(UniValue::VARR);
381 else
382 throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array or object");
383}
384
385bool IsDeprecatedRPCEnabled(const std::string& method)
386{

Callers 3

postprocess_translationsFunction · 0.45
HTTPReq_JSONRPCFunction · 0.45
JSONRPCExecOneFunction · 0.45

Calls 7

JSONRPCErrorFunction · 0.85
SanitizeStringFunction · 0.85
isObjectMethod · 0.80
isNullMethod · 0.80
isStrMethod · 0.80
isArrayMethod · 0.80
UniValueClass · 0.70

Tested by

no test coverage detected