Skip to content

Commit 06acc97

Browse files
committed
fix(pencil): Ignore options when cleaning sessions
1 parent bcc62bd commit 06acc97

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/interceptors/http-server-interceptor.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ export default class HttpServerInterceptor extends Interceptor implements IInter
102102
return;
103103
}
104104

105-
intercept(this.req && this.req.sn_uid, 'end');
106-
const { req, res } = SessionManager.getSession(this.req?.sn_uid);
107-
if (req && res) {
108-
risk({ event: EventType.RISK, context: { req: contextFromRequest(req), res: contextFromResponse(res) } });
105+
if (this.req && this.req.method !== 'OPTIONS') {
106+
intercept(this.req.sn_uid, 'end');
107+
const { req, res } = SessionManager.getSession(this.req?.sn_uid);
108+
if (req && res) {
109+
risk({ event: EventType.RISK, context: { req: contextFromRequest(req), res: contextFromResponse(res) } });
110+
}
111+
112+
SessionManager.cleanSession(this.req.sn_uid);
109113
}
110-
111-
SessionManager.cleanSession(this.req && this.req.sn_uid);
112-
113114
return original.apply(this, arguments);
114115
};
115116
});

0 commit comments

Comments
 (0)