mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Set content type for /api/inventory
Set the correct content type to JSON to for the /api/inventory endpoints.
This commit is contained in:
1 parent
38c60c221f
commit
27ef00705b
1 file changed
+2
@@ -29,6 +29,7 @@ function addApiRoutes(app, items, endpointHitCounter) {
|
|||||||
for (let [name, count] of items._items) {
|
for (let [name, count] of items._items) {
|
||||||
inventory.push({ name, count });
|
inventory.push({ name, count });
|
||||||
}
|
}
|
||||||
|
res.type("json");
|
||||||
res.send(JSON.stringify(inventory));
|
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-Origin", "*");
|
||||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||||
// Check it and send it
|
// Check it and send it
|
||||||
|
res.type("json");
|
||||||
res.send(JSON.stringify(items.serialise()));
|
res.send(JSON.stringify(items.serialise()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user