Return 422 Unprocessable Content for unimplemented functionality.
This commit is contained in:
parent
8ef2b9bd72
commit
ef89bec646
1 changed files with 13 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
var db = require('../lib/db');
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var _express = require('express');
|
||||
var jsonld = require('jsonld');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* @param {express.IRoute} routeObj
|
||||
* @param {_express.IRoute} routeObj
|
||||
*/
|
||||
route: (routeObj) => {
|
||||
routeObj.post(async (req, res, _next) => {
|
||||
|
@ -14,6 +16,11 @@ module.exports = {
|
|||
if ( bodyParsed.type === 'Create') {
|
||||
var to;
|
||||
var cc;
|
||||
if ( typeof bodyParsed.object === 'string' ) {
|
||||
res.status(422);
|
||||
res.body('Unimplemented');
|
||||
return res.end();
|
||||
}
|
||||
if ( typeof bodyParsed.object.to === 'string' ) {
|
||||
to = [bodyParsed.object.to];
|
||||
} else {
|
||||
|
@ -35,7 +42,11 @@ module.exports = {
|
|||
)
|
||||
});
|
||||
res.status(204);
|
||||
res.end();
|
||||
return res.end();
|
||||
} else {
|
||||
res.status(422);
|
||||
res.body('Unimplemented');
|
||||
return res.end();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue