mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-22 17:29:19 +02:00
Protect against TypeError
Only attempt to call req.headers.accept.include() if req.headers.accept exists.
This commit is contained in:
parent
04801687d9
commit
5ad4516a70
|
@ -15,7 +15,7 @@ router.get('/:name', function (req, res) {
|
||||||
if (result === undefined) {
|
if (result === undefined) {
|
||||||
return res.status(404).json(`No record found for ${name}.`);
|
return res.status(404).json(`No record found for ${name}.`);
|
||||||
}
|
}
|
||||||
else if (req.headers.accept.includes('application/activity+json') || req.headers.accept.includes('application/json') || req.headers.accept.includes('application/json+ld')) {
|
else if (req.headers.accept && (req.headers.accept.includes('application/activity+json') || req.headers.accept.includes('application/json') || req.headers.accept.includes('application/json+ld'))) {
|
||||||
res.json(JSON.parse(result.actor));
|
res.json(JSON.parse(result.actor));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue