Skip to content

Commit

Permalink
framework: remove uicontext by default (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined-moe committed Nov 4, 2024
1 parent d0f9f78 commit 7a0a6cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions framework/framework/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export default (logger, xff, xhost) => async (ctx: KoaContext, next: Next) => {
|| request.query.noTemplate || !response.template) {
// Send raw data
try {
if (typeof response.body === 'object') {
response.body.UiContext = UiContext;
response.body.UserContext = user;
if (typeof response.body === 'object' && request.headers['x-hydro-inject']) {
const inject = request.headers['x-hydro-inject'].toString().toLowerCase().split(',').map((i) => i.trim());
if (inject.includes('uicontext')) response.body.UiContext = UiContext;
if (inject.includes('usercontext')) response.body.UserContext = user;
}
response.body = JSON.stringify(response.body, serializer(false, handler));
} catch (e) {
Expand Down

0 comments on commit 7a0a6cc

Please sign in to comment.