Skip to content
Snippets Groups Projects
Verified Commit 3d244470 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: add raw data to restapi respond

parent 434a6b80
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,16 @@ import { WriteError } from "./restapi/writeerror.mjs";
export { RestAPI };
/**
* @type {symbol}
* @memberOf Monster
* @license AGPLv3
* @since 3.12.0
*/
const rawDataSymbol = Symbol.for("@schukai/monster/data/datasource/server/restapi/rawdata");
/**
* The RestAPI is a class that enables a REST API server.
*
......@@ -182,6 +192,9 @@ function fetchData(init, key, callback) {
try {
obj = JSON.parse(body);
response[rawDataSymbol] = obj;
} catch (e) {
if (body.length > 100) {
body = `${body.substring(0, 97)}...`;
......@@ -193,6 +206,7 @@ function fetchData(init, key, callback) {
if (callback && isFunction(callback)) {
callback(obj);
}
return response;
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment