mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Move content-length calculation to http module
- consolidate http / https functionality to single function
This commit is contained in:
parent
ccfafe1b31
commit
9f03d18e49
2 changed files with 14 additions and 30 deletions
|
@ -20,7 +20,6 @@ export async function sendJsonRpcRequest(url, method, params, username, password
|
|||
|
||||
const client = new JSONRPCClient(async (rpcRequest) => {
|
||||
const body = JSON.stringify(rpcRequest);
|
||||
headers['content-length'] = Buffer.byteLength(body);
|
||||
const httpRequestParams = {
|
||||
method: "POST",
|
||||
headers,
|
||||
|
@ -49,7 +48,7 @@ export async function sendJsonRpcRequest(url, method, params, username, password
|
|||
}
|
||||
catch (e) {
|
||||
if (e instanceof JSONRPCErrorException) {
|
||||
logger.warn("Error calling JSONPRC endpoint: %s. %s", url, e.message);
|
||||
logger.debug("Error calling JSONPRC endpoint: %s. %s", url, e.message);
|
||||
return [200, "application/json", JSON.stringify({result: null, error: {code: e.code, message: e.message}})];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue