Set content type for /api/inventory

Set the correct content type to JSON to for the /api/inventory endpoints.
This commit is contained in:
Hornwitser committed 2020-03-22 02:10:54 +01:00
1 parent 38c60c221f
commit 27ef00705b
1 file changed
+2
+2
View File
@@ -29,6 +29,7 @@ function addApiRoutes(app, items, endpointHitCounter) {
for (let [name, count] of items._items) {
inventory.push({ name, count });
}
res.type("json");
res.send(JSON.stringify(inventory));
});
@@ -45,6 +46,7 @@ function addApiRoutes(app, items, endpointHitCounter) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
// Check it and send it
res.type("json");
res.send(JSON.stringify(items.serialise()));
});
}