mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Move content-length calculation to http module
- consolidate http / https functionality to single function
This commit is contained in:
@@ -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}})];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user