fix content negotiation

This commit is contained in:
Will Murphy 2019-09-27 23:28:12 -05:00
parent 6f17ad2f40
commit ab44393c0b
2 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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')