fix: missing req.body when parsing ActivityPub requests

This commit is contained in:
Julian Lam
2023-06-26 16:15:25 -04:00
parent 9dfa1b7209
commit e6753ce5db
3 changed files with 12 additions and 3 deletions

View File

@@ -194,6 +194,9 @@ ActivityPub.send = async (uid, targets, payload) => {
resolveWithFullResponse: true,
});
console.log(response.statusCode, response.body);
if (response.statusCode !== 201) {
// todo: i18n this
throw new Error('activity-failed');
}
}));
};

View File

@@ -99,7 +99,7 @@ Controller.getInbox = async (req, res) => {
};
Controller.postInbox = async (req, res) => {
console.log(req.body);
console.log('received', req.body);
res.sendStatus(201);
};

View File

@@ -229,7 +229,13 @@ function configureBodyParser(app) {
}
app.use(bodyParser.urlencoded(urlencodedOpts));
const jsonOpts = nconf.get('bodyParser:json') || {};
const jsonOpts = nconf.get('bodyParser:json') || {
type: [
'application/json',
'application/ld+json',
'application/activity+json',
],
};
app.use(bodyParser.json(jsonOpts));
}