diff --git a/core/server/api/shared/headers.js b/core/server/api/shared/headers.js index 5935efca9d..3c6bcf21cd 100644 --- a/core/server/api/shared/headers.js +++ b/core/server/api/shared/headers.js @@ -21,7 +21,7 @@ const disposition = { return { 'Content-Disposition': options.value, 'Content-Type': 'application/json', - 'Content-Length': JSON.stringify(result).length + 'Content-Length': Buffer.byteLength(JSON.stringify(result)) }; }, @@ -29,7 +29,7 @@ const disposition = { return { 'Content-Disposition': options.value, 'Content-Type': 'application/yaml', - 'Content-Length': JSON.stringify(result).length + 'Content-Length': Buffer.byteLength(JSON.stringify(result)) }; } }; diff --git a/core/server/api/v0.1/index.js b/core/server/api/v0.1/index.js index bece9c23ee..17ed4f1125 100644 --- a/core/server/api/v0.1/index.js +++ b/core/server/api/v0.1/index.js @@ -229,7 +229,7 @@ const addHeaders = (apiMethod, req, res, result) => { res.set({ 'Content-Disposition': header, 'Content-Type': 'application/json', - 'Content-Length': JSON.stringify(result).length + 'Content-Length': Buffer.byteLength(JSON.stringify(result)) }); }); } @@ -241,7 +241,7 @@ const addHeaders = (apiMethod, req, res, result) => { res.set({ 'Content-Disposition': header, 'Content-Type': 'application/yaml', - 'Content-Length': JSON.stringify(result).length + 'Content-Length': Buffer.byteLength(JSON.stringify(result)) }); }); }