diff --git a/index.js b/index.js index da29b90..feac614 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,7 @@ app.param('name', function (req, res, next, id) { }) // json only routes -app.use('/.well-known/webfinger', net.validators.jsonld, cors(), routes.webfinger) +app.use('/.well-known/webfinger', cors(), routes.webfinger) app.use('/o', net.validators.jsonld, cors(), routes.object) app.use('/s', net.validators.jsonld, cors(), routes.stream) app.use('/u/:name/inbox', net.validators.jsonld, routes.inbox) diff --git a/net/validators.js b/net/validators.js index 9f76170..974ea58 100644 --- a/net/validators.js +++ b/net/validators.js @@ -14,10 +14,10 @@ function activity (req, res, next) { } function jsonld (req, res, next) { - if (req.method === 'GET' && pub.consts.jsonldTypes.includes(req.get('Accept'))) { + if (req.method === 'GET' && req.accepts(pub.consts.jsonldTypes)) { return next() } - if (req.method === 'POST' && pub.consts.jsonldTypes.includes(req.get('Content-Type'))) { + if (req.method === 'POST' && req.is(pub.consts.jsonldTypes)) { return next() } next('route')