|
|
@ -85,7 +85,20 @@ const sendToProxy = async (options = {}, targetNode) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const jsonRes = JSON.parse(plaintext);
|
|
|
|
const jsonRes = JSON.parse(plaintext);
|
|
|
|
// emulate nodeFetch response...
|
|
|
|
// emulate nodeFetch response...
|
|
|
|
jsonRes.json = () => JSON.parse(jsonRes.body);
|
|
|
|
jsonRes.json = () => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
return JSON.parse(jsonRes.body);
|
|
|
|
|
|
|
|
} catch(e) {
|
|
|
|
|
|
|
|
log.error(
|
|
|
|
|
|
|
|
'lokiRpc sendToProxy error',
|
|
|
|
|
|
|
|
e.code,
|
|
|
|
|
|
|
|
e.message,
|
|
|
|
|
|
|
|
'json',
|
|
|
|
|
|
|
|
jsonRes.body
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
return jsonRes;
|
|
|
|
return jsonRes;
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
log.error(
|
|
|
|
log.error(
|
|
|
|