Skip to content

Commit

Permalink
feat: add is-governance-body header key
Browse files Browse the repository at this point in the history
  • Loading branch information
ec2sw committed Jun 7, 2022
1 parent 093789c commit 6e9f771
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import {
} from './utils/data-assertions';
import packageJson from '../package.json';

const { API_KEY, READ_ONLY } = getConfig().APP;
const { API_KEY, READ_ONLY, IS_GOVERNANCE_BODY } = getConfig().APP;

const headerKeys = Object.freeze({
API_VERSION_HEADER_KEY: 'x-api-version',
CR_READY_ONLY_HEADER_KEY: 'cw-read-only',
DATA_MODEL_VERION_HEADER_KEY: 'x-datamodel-version',
GOVERNANCE_BODY_HEADER_KEY: 'x-governance-body',
});

const app = express();
Expand Down Expand Up @@ -75,6 +76,11 @@ app.use(function (req, res, next) {
next();
});

app.use(function (req, res, next) {
res.setHeader(headerKeys.GOVERNANCE_BODY_HEADER_KEY, IS_GOVERNANCE_BODY);
next();
});

app.use(function (req, res, next) {
logger.debug(
`Setting header x-api-verion to package.json version: ${packageJson.version}`,
Expand Down

0 comments on commit 6e9f771

Please sign in to comment.