Skip to content
This repository has been archived by the owner on Feb 6, 2019. It is now read-only.

Fix to add/remove values also from response #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -32,7 +32,7 @@ policies:
response:
add:
- name: createdBy
value: "'Clark Kent'"
value: res.body.fullname
remove:
- uselessParam
```
Expand Down
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -68,6 +68,7 @@ const plugin = {
const _write = res.write;
res.write = (data) => {
try {
res.body = JSON.parse(data);
const body = transformBody(params.response, req.egContext, JSON.parse(data));
const bodyData = JSON.stringify(body);

Expand Down