Fix various Content-Lenght's

This commit is contained in:
Bryan Ashby 2023-01-31 20:06:07 -07:00
parent a829905c63
commit 98d37e9564
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
4 changed files with 7 additions and 7 deletions

View File

@ -46,7 +46,7 @@ function postJson(url, json, options, cb) {
function _makeRequest(url, options, cb) {
if (options.body) {
options.headers['Content-Length'] = options.body.length;
options.headers['Content-Length'] = Buffer(options.body).length;
if (options?.sign?.headers?.includes('digest')) {
options.headers['Digest'] =

View File

@ -415,7 +415,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {
const body = JSON.stringify(collection);
const headers = {
'Content-Type': ActivityStreamMediaType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};
resp.writeHead(200, headers);
@ -715,7 +715,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {
const headers = {
'Content-Type': ActivityStreamMediaType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};
resp.writeHead(200, headers);
@ -746,7 +746,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {
const headers = {
'Content-Type': contentType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};
resp.writeHead(200, headers);

View File

@ -51,7 +51,7 @@ exports.getModule = class NodeInfo2WebHadnler extends WebHandlerModule {
const body = JSON.stringify(nodeInfo);
const headers = {
'Content-Type': 'application/json',
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};
resp.writeHead(200, headers);

View File

@ -124,7 +124,7 @@ exports.getModule = class WebFingerWebHandler extends WebHandlerModule {
const headers = {
'Content-Type': contentType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};
resp.writeHead(200, headers);
@ -176,7 +176,7 @@ exports.getModule = class WebFingerWebHandler extends WebHandlerModule {
const headers = {
'Content-Type': 'application/jrd+json',
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};
resp.writeHead(200, headers);