Ensured that endpoint header config is not modified in future

refs https://linear.app/tryghost/issue/ENG-674/

This will cause errors to be thrown if developers attempt to modify the shared
header config in future.
This commit is contained in:
Fabien O'Carroll 2024-02-27 16:17:06 -05:00 committed by Fabien 'egg' O'Carroll
parent ec697051dc
commit 93263fa7be

View File

@ -188,6 +188,8 @@ const pipeline = (apiController, apiUtils, apiType) => {
return keys.reduce((obj, method) => {
const apiImpl = _.cloneDeep(apiController)[method];
Object.freeze(apiImpl.headers);
obj[method] = async function wrapper() {
const apiConfig = {docName, method};
let options;