Skip to content

Commit 2cac0d2

Browse files
committed
framework: remove uicontext by default (#900) (#901)
1 parent 12aee78 commit 2cac0d2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

framework/framework/base.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ export default (logger, xff, xhost) => async (ctx: KoaContext, next: Next) => {
6767
|| request.query.noTemplate || !response.template) {
6868
// Send raw data
6969
try {
70-
if (typeof response.body === 'object') {
71-
response.body.UiContext = UiContext;
72-
response.body.UserContext = user;
70+
if (typeof response.body === 'object' && request.headers['x-hydro-inject']) {
71+
const inject = request.headers['x-hydro-inject'].toString().toLowerCase().split(',').map((i) => i.trim());
72+
if (inject.includes('uicontext')) response.body.UiContext = UiContext;
73+
if (inject.includes('usercontext')) response.body.UserContext = user;
7374
}
7475
response.body = JSON.stringify(response.body, serializer(false, handler));
7576
} catch (e) {

0 commit comments

Comments
 (0)