From ab44393c0b44d3d8a58ed345aa387fc77bca5598 Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Fri, 27 Sep 2019 23:28:12 -0500 Subject: [PATCH] fix content negotiation --- index.js | 2 +- net/validators.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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')