Skip to content

Commit 8f93bbb

Browse files
committed
changes during review and testing
1 parent 10e9c9f commit 8f93bbb

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

routes/delete.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ router.delete('/', checkAccessToken, async (req, res, next) => {
1010
// check for @id in body. Any value is valid. Lack of value is a bad request.
1111
if (!req?.body || !(req.body['@id'] ?? req.body.id)) {
1212
res.status(400).send("No record id to delete! (https://store.rerum.io/v1/API.html#delete)")
13+
return
1314
}
1415
const body = JSON.stringify(req.body)
1516
const deleteOptions = {

routes/overwrite.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import express from "express"
22
import checkAccessToken from "../tokens.js"
33
const router = express.Router()
4-
import rerumPropertiesWasher from "../preprocessor.js"
54

65
/* PUT an overwrite to the thing. */
7-
router.put('/', checkAccessToken, rerumPropertiesWasher, async (req, res, next) => {
6+
router.put('/', checkAccessToken, async (req, res, next) => {
87

98
try {
109

1110
const overwriteBody = req.body
1211
// check for @id; any value is valid
1312
if (!(overwriteBody['@id'] ?? overwriteBody.id)) {
14-
throw Error("No record id to overwrite! (https://store.rerum.io/API.html#overwrite)")
13+
res.status(400).send("No record id to overwrite! (https://store.rerum.io/API.html#overwrite)")
14+
return
1515
}
1616

1717
const overwriteOptions = {

routes/update.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import express from "express"
22
import checkAccessToken from "../tokens.js"
33
const router = express.Router()
4-
import rerumPropertiesWasher from "../preprocessor.js"
54

65
/* PUT an update to the thing. */
7-
router.put('/', checkAccessToken, rerumPropertiesWasher, async (req, res, next) => {
6+
router.put('/', checkAccessToken, async (req, res, next) => {
87

98
try {
109
// check for @id in body. Any value is valid. Lack of value is a bad request.
1110
if (!req?.body || !(req.body['@id'] ?? req.body.id)) {
1211
res.status(400).send("No record id to update! (https://store.rerum.io/v1/API.html#update)")
12+
return
1313
}
1414
// check body for JSON
1515
const body = JSON.stringify(req.body)

0 commit comments

Comments
 (0)