MCPcopy Create free account
hub / github.com/baidu/openrasp / checkContext

Function checkContext

agent/java/integration-test/rasp/plugins/plugin.js:8–24  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

6var plugin = new RASP('test');
7
8function checkContext(context) {
9 function assert(flag) {
10 if (!flag) {
11 throw new Error();
12 }
13 }
14
15 assert(context.method);
16 assert(context.protocol === 'http/1.1');
17 assert(context.server);
18 assert(context.url);
19 assert(context.path);
20 assert(context.parameter.test[0] === 'a' && context.parameter.test[1] === 'b');
21 assert(context.header['test-test'] === 'Test-Test');
22 assert(context.querystring);
23 assert(context.remoteAddr);
24}
25
26plugin.register('request', function (params, context) {
27 if (/request/.test(context.path)) {

Callers 1

plugin.jsFile · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected